Hello
I am creating this thread so that members of the community can share useful tips and tricks they have learned during their time of scripting
to begin with, here a few tricks I have picked up:
Ternary operation
In C and other languages it is possible to use a ternary operator such as (a == 3 ? b : c) which is essentially a very short one line if statement that says:
if a is equal to three then b otherwise c
you can also do this in Lua as follows
a == 3 and b or c
Multiline string
You can write multiline strings using [[text]] such as
print([[Lorem ipsum dolor sit amet, consectetur adipiscing elit.]])
Function parenthesis
If you are calling a function which has a single parameter of either a string or a table you can use the following syntax:
print("test") -- Valid print "test" -- Also valid func({ m_test = true }) -- Valid func { m_test = true } -- Also valid
There are a lot more cool things you can do with Lua, if you have something you wish to share feel free to post below