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 » Scripting Helpers
Home Search
 

Re: Is it possible to manipulate variable declaration and convert string to an object string ?

Previous Thread :: Next Thread 
eSvena is not online. eSvena
Joined: 11 Aug 2011
Total Posts: 75
28 Mar 2012 06:03 AM
I'm trying to create variables into a loop with no table. Following script is wrong.

for i = 1, 10 do
[var..toObjectstring(i)]=i
end

And we'd be able to do print(var3) for example.
Report Abuse
DragonFang1 is not online. DragonFang1
Joined: 02 Apr 2009
Total Posts: 1068
28 Mar 2012 06:40 AM
what kind of variable , say what you want to do ?
Report Abuse
DigitalMirage is not online. DigitalMirage
Joined: 08 Dec 2011
Total Posts: 421
28 Mar 2012 07:13 AM
[ Content Deleted ]
Report Abuse
littleAU999 is not online. littleAU999
Joined: 15 Jan 2011
Total Posts: 1375
28 Mar 2012 07:20 AM
I think you create a table, then use 'table.insert' like the post above...
Report Abuse
DigitalMirage is not online. DigitalMirage
Joined: 08 Dec 2011
Total Posts: 421
28 Mar 2012 07:22 AM
[ Content Deleted ]
Report Abuse
DigitalMirage is not online. DigitalMirage
Joined: 08 Dec 2011
Total Posts: 421
28 Mar 2012 07:25 AM
[ Content Deleted ]
Report Abuse
littleAU999 is not online. littleAU999
Joined: 15 Jan 2011
Total Posts: 1375
28 Mar 2012 07:29 AM
Nice script^ I just learned a bit from that. C:
Report Abuse
DigitalMirage is not online. DigitalMirage
Joined: 08 Dec 2011
Total Posts: 421
28 Mar 2012 07:30 AM
[ Content Deleted ]
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
28 Mar 2012 07:42 AM
You could use getfenv
Report Abuse
littleAU999 is not online. littleAU999
Joined: 15 Jan 2011
Total Posts: 1375
28 Mar 2012 07:42 AM
:3... :
objects = {}
for i = 1, 10 do
table.insert(objects,"Hi"..i)
print(objects[i])
end
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
28 Mar 2012 07:44 AM
You didn't get the point..
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
28 Mar 2012 07:47 AM
for i=1,10 do
getfenv()["var".. i]=i
end

print(getfenv()["var3"])
>3
Report Abuse
DigitalMirage is not online. DigitalMirage
Joined: 08 Dec 2011
Total Posts: 421
28 Mar 2012 07:59 AM
[ Content Deleted ]
Report Abuse
eSvena is not online. eSvena
Joined: 11 Aug 2011
Total Posts: 75
28 Mar 2012 08:21 AM
@su8 : I can I convert "var3" to var3 ?

Convert print(getfenv()["var3"])
To print(var3)
Report Abuse
eSvena is not online. eSvena
Joined: 11 Aug 2011
Total Posts: 75
28 Mar 2012 08:23 AM
*I can I* Horrible mistake O.o

Anyway, setfenv() can do it ?
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
28 Mar 2012 08:23 AM
Why would you want it like that?
Report Abuse
eSvena is not online. eSvena
Joined: 11 Aug 2011
Total Posts: 75
28 Mar 2012 08:29 AM
Oh nvm... Thanks anyway!
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
28 Mar 2012 08:50 AM
To fix your script:


for i = 1, 10 do
getfenv()["var"..i]=i
end
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
28 Mar 2012 08:53 AM
What was wrong with my script?
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
28 Mar 2012 08:56 AM
[ Content Deleted ]
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
28 Mar 2012 09:00 AM
Oh.. cool..

Learn something new every day :D
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
28 Mar 2012 09:19 AM
>What was wrong with my script?

I was talking to the OP. I didn't read any other posts in the thread.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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