Talk:Optional Arguments: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
What if you replace one of the previous arguments with 'nil'? Atleast that works with addBan(). | 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. [[User:EAi|eAi]] 21:43, 4 January 2011 (UTC) | : It depends on the function, some support that, some don't. [[User:EAi|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) | : 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) [[User:Kamshak|Kamshak]] 19:18, 4 May 2011 (CEST) |
Revision as of 17:18, 4 May 2011
"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)