1. So I’ve seen some code some code do something like local x = 3; and Im wondering what ; means. Is it decorative or does it actually serve a purpose?
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Ive tried googling & looking on dev hub as well as going through a bit of lua documentation. And I haven’t really found anything useful Any help would be apricated
One reason why people will put it in is because it’s required in some other languages. Lua doesn’t really need semicolons, but it is required in languages like c++. It essentially just is appended to the end of a command to let the compiler know where it ends. For example this is an example of “hello world” in c++.
Those semicolons are after specific commands to the computer. If you didn’t put the semicolons on those lines, the code would give a syntax error. So if you were to use c++ a lot you might get in the habit of putting in semicolons. (my friend always puts semicolons for this reason)
Some of the code you see in lua that ends in semicolons probably comes from someone familiar with one of the other languages that requires them. They likely just put them in by habit or preference. They are also sometimes used to make separations more clear to a reader when used on a single line.
I think generally it’s best not to put in semicolons for languages that don’t need them unless it’s generally used just for the sake of consistency.
Without ; in C++ script might error because in the C++, the ; is useful to connect the one code to the other codes! and #include isn’t needed ; because the #include have the <>, so its too confusing with a ; in after of the #include code…
in the lua, it just a fragile code because : is more effective than ;.