How would I program optional arguments for a function?
It's some-what confusing, if you try to over-complicate it.
With optional arguments, they must be at the end of the function's arguments list.
function SomeFunc(a, b, c) if a then print(tostring(a)) end if b and c then print(tostring(b)..tostring(c)) end end SomeFunc("HI!") --> HI! SomeFunc("Nothing", "Woot") --> Nothing [`c` wasn't specified, so it defaulted to nil, and would be false in the if statement] SomeFunc("This", "Does", "Work") --> This (new line) DoesWork
What happens is whenever a function is called and not every argument is passed, it sets those arguments that weren't passed to nil
.