mrvicio Posted November 30, 2011 Share Posted November 30, 2011 hi all again as the title says. . . whats mean (. . .)? like in this function table.find(t, ...) thanks before hand Link to comment
Castillo Posted November 30, 2011 Share Posted November 30, 2011 In your case, the "..." works as a table of arguments later used in table.find function. Example of using "..." as argument: addCommandHandler("text", function( player, command, ... ) local text = table.concat({...}, " ") -- This way the player can type texts with [b][u]spaces[/u][/b]. outputChatBox(tostring(text)) end) Link to comment
50p Posted November 30, 2011 Share Posted November 30, 2011 Each function that has "..." as parameter, passes another hidden table that is arg. So, you can use arg instead of creating new table with all parameters. In addition, arg table has a addCommandHandler("text", function( player, command, ... ) local text = table.concat(arg, " ") -- This way the player can type texts with spaces. outputChatBox( text ); end) table.concat returns string so there is no need to convert it to string. Link to comment
mrvicio Posted November 30, 2011 Author Share Posted November 30, 2011 thanks for you two!!! thanks a lot!! i got my brain clean Link to comment
Scooby Posted December 6, 2011 Share Posted December 6, 2011 is there any need for the semicolon here: outputChatBox( text ); just curious because ive never needed to use one like this. Link to comment
arezu Posted December 6, 2011 Share Posted December 6, 2011 is there any need for the semicolon here: outputChatBox( text );just curious because ive never needed to use one like this. In most scripting/programming language, semicolons are used, but in lua its optional (makes no difference if used or not). Link to comment
Scooby Posted December 6, 2011 Share Posted December 6, 2011 ah so 50p used it out of habit.. ok thanks.... i see it quite a lot within code from experienced scripters but have never needed to use it myself... i wasnt sure if it had some use in Lua or not. thanks for the quick reply. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now