What is a difference between a semi-colon ( ; ), and a Comma ( , ) in Syntax?
They appear to do the same thing with some minor differences.
local thing1, thing2 = "hi", "hello" -- works
local t1; t2 = "hu", "io" -- underlined but no error?
local t3; t4 = "il"; "li" -- errors?
local Item = "hi"; print(Item) -- less Ugly?
local Item1 = "hi", print(Item1) --underlined?
local Table = {1,2,3,4,5} -- works
local TableSemi = {1;2;3;4;5} -- also works?
( ; ) Is mostly used in other programming languages, like javascript for an example, I’m pretty sure they added this for javascript users to able to use Lua easier. Anyways, its usualy used for line breaks, for example
local player = game.Players.LocalPlayer;
local character = player.Character or player.CharacterAdded:Wait();
Commas ( , ) are used for same line breaks for example
local Table = {'A','B','C'}
In conclusion they are pretty much the same, they are mostly used for line breaks. I hope this answers your question!
EDIT:
This probably doesn’t work because Lua thinks t3 and t4 are on a different line, so it gets confused on where “il” and “'li” goes.
Stylistically, the use of semi-colons are more common in Java, JavaScript too, with the former having importance for the compiler. Preferably in Lua(and Luau), you would use commas over the semi-colons as it is more declared by the style guidelines. The latter should only be used in edge cases where the commas do not apply.