Talk:Optional Arguments

From Multi Theft Auto: Wiki
Revision as of 17:18, 4 May 2011 by Kamshak (talk | contribs)
Jump to navigation Jump to search

"Optional Arguments have one limitation. You cannot use any optional arguments unless all previous arguments are also supplied."

What if you replace one of the previous arguments with 'nil'? Atleast that works with addBan().

It depends on the function, some support that, some don't. eAi 21:43, 4 January 2011 (UTC)
Lua always passes nil for elements that are not specified so it should work with all functions(cf. Programming in Lua 2nd edition p.36), unless one argument requires another optional argument to work(for example colors, you can not set red to nil and green and blue to 255 and expect it to work) Kamshak 19:18, 4 May 2011 (CEST)