generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Do anyone about "Vararg functions"?

Previous Thread :: Next Thread 
Blackplug is not online. Blackplug
Joined: 06 Dec 2010
Total Posts: 1714
20 Jun 2012 02:42 AM
Can you give me an example of how to use them?
Report Abuse
FPGA is not online. FPGA
Joined: 05 May 2012
Total Posts: 372
20 Jun 2012 02:43 AM
function f(...)
t = {...}
-- t is a table containing all arguments to f
end
Report Abuse
redditor is not online. redditor
Joined: 26 Jul 2011
Total Posts: 182
20 Jun 2012 04:47 AM
They're pretty cool. I just haven't found a use for them. That or fpga and I have no idea what either of us are talking about.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
20 Jun 2012 07:46 AM
local function tableMerge(...)
local tables = {...}
local output = {}
for _, input in pairs(tables) do
for _, element in pairs(input) do
table.insert(output, element)
end
end
return output
end

print(table.concat(tableMerge({1,2,3}, {4}, {5,6,99})))
Report Abuse
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
20 Jun 2012 01:20 PM
It's for functions with a dynamic number of inputs.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
20 Jun 2012 02:09 PM
local printl=print
function print(...)
printl(...)
end
Report Abuse
lombardo2 is not online. lombardo2
Joined: 30 Nov 2008
Total Posts: 1604
20 Jun 2012 02:13 PM
Yeah I think varargs refers to Variable arguments, in lua we use ... to declare that
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image