Unclear % operation for counting

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
BrotSagtMist
Party member
Posts: 615
Joined: Fri Aug 06, 2021 10:30 pm

Re: Unclear % operation for counting

Post by BrotSagtMist »

name=function() end; is the _pure_ form of creating a function and assigning a name to it.
function name() end; is annoying syntax sugar for the same line that was added for people with no taste.

And the other thing is syntax hell based on two grounds:
Lua does sometimes not care about newlines, and sometimes it does, have fun finding it out.
The () brackets are optional when calling a function.
The code your quoted there is a function call to StateMachine with a table as argument.

Code: Select all

print('bla') -- tutorial form
print"bla" --valid
print"bl 
a"  --invalid
print
"bla" --valid, but heck, why?
print[[bl
a]] --valid
print{} --valid but useless
Now dont get me started on comments, [[ can be used for strings, comments and logical comment blocks.
obey
Post Reply

Who is online

Users browsing this forum: No registered users and 49 guests