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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do I use (...) as a table?

Previous Thread :: Next Thread 
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 10:39 PM
I need to know how to print individual components of the (...) table (is it at table?)

function hi (...)
--print statement...what goes here to print all args?
end

hi (1,2,3)
Report Abuse
NormaINorm is not online. NormaINorm
Joined: 11 Dec 2012
Total Posts: 315
16 Dec 2015 10:42 PM
local table = {...}
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 10:43 PM
ah, I get it. Thanks!

Also what version of Lua is roblox currently using?
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 10:47 PM
I'm wondering if there's any way to edit a value in (...) without making the whole thing into a table
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Dec 2015 10:49 PM
Well sort of, but it's really not a good idea.

You can get certain values of a tuple using the select function but just stick to tables.
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 10:56 PM
I made a sort-of-OOP thing for sending and receiving remote events and I'm using (...) a lot

But the thing is that I'm wanting to serialize empty tables into a string "empty table" which i can later deserialize into an empty table because otherwise I get a weird "keys must be strings" error when sending empty tables to and fro

So yeah, I'm wanting to search for a table in (...), checking if it's empty and changing it.
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 10:56 PM
and serializing it.*
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 10:57 PM
Why isn't it a good idea, I'd really like to know?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Dec 2015 11:00 PM
Dealing with tuples like that is a hassle and is just asking for trouble.
If it's a tuple, it can be an array (so to speak). So you're not going to run into problems treating them as arrays then (if you really want to) reunpacking them.
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 11:01 PM
How do I remake the array into a tuple?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Dec 2015 11:02 PM
unpack(blah)
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
16 Dec 2015 11:02 PM
Okay, thanks for the help
Report Abuse
XIPokezIX is not online. XIPokezIX
Joined: 24 Sep 2015
Total Posts: 381
17 Dec 2015 03:05 AM
tuples like this are only really necessary for events imo
Report Abuse
UnstableScript is not online. UnstableScript
Joined: 11 Dec 2015
Total Posts: 410
17 Dec 2015 06:16 AM
^ They are necessary in a lot of cases, most being the thing your sending the parameters to won't know what it is, so you will send a couple of arguments.

function output(type, ...)
if type == 'print' then
for k, v in next, {...} do
print(k, v)
end
elseif type == 'warn' then
for k, v in next, {...} do
warn(k, v) --Warn can take > 1 arguments? I am not sure..
end
else
print'no other types defined yet'
end
end
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
17 Dec 2015 10:53 AM
local func=function(...)
local args={...}
args=unpack(args)
otherfunc(args)
end

I'm wanting to pass arguments into func, create a table out of the tuple then remake the table into a tuple which I want to send on its way to otherfunc with the same arguments func received. But I'm doing it wrong. Halp
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
17 Dec 2015 10:57 AM
local func=function(...)
otherfunc(...)
end
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
17 Dec 2015 11:01 AM
Yeah I know but I'm trying to pack the taple into a tuple then unpack it again. Not sure if it's possible though
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
17 Dec 2015 11:05 AM
table*
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
17 Dec 2015 11:06 AM
You can't set a variable to a tuple...

local func=function(...)
local args={...}
otherfunc(unpack(args))
end
Report Abuse
progatician is not online. progatician
Joined: 30 Aug 2013
Total Posts: 8429
17 Dec 2015 11:16 AM
Oh, man. Thanks!
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