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: Tables

Previous Thread :: Next Thread 
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
31 Mar 2015 07:18 PM
Hi, I'm extremely used to python and never programmed using Lua in months. How would you want to index particular elements in a table? Would it be like this?

table = {"hello","blah","blah2"}
print(table[0])

and like this?

table.insert(table[0],"table")
print(table[0])
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
31 Mar 2015 07:20 PM
Lua indices start at 1.

table.insert(table, [pos,] value)
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
31 Mar 2015 07:21 PM
table.insert(table, 1, 'bob')
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
31 Mar 2015 07:22 PM
table = {"hello","blah","blah2"}
print(table[1]) -- lua tables start at 1

and like this?

table.insert(table,"table") -- that adds it to the end of the table
table[1] = "table" -- i think thats how u replace something in a table
print(table[1])
Report Abuse
verbalAKspray is not online. verbalAKspray
Joined: 09 Jul 2014
Total Posts: 23685
31 Mar 2015 07:23 PM
oh yea what amanda said with table.insert(table, 1, 'table') is what u should use to change something in a table

i forgot about that
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
31 Mar 2015 07:25 PM
Thanks. :D
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