Posted 02 November 2012 - 09:22 AM
So I have a table defined as
that contains various blocks such as
and that table contains info about the block, like the id.
Now say if I wanted to retrieve the id of a block when using the input from the user
How do I use that variable to access the id (if item = cobblestone)?
Lua treats the "item" segment as a literal table not as a variable.
Any suggestions?
itemTable = {}
that contains various blocks such as
itemTable.cobblestone = {}
and that table contains info about the block, like the id.
itemTable.cobblestone.id = 4
Now say if I wanted to retrieve the id of a block when using the input from the user
item = os.read()
How do I use that variable to access the id (if item = cobblestone)?
print(itemTable.item.id)
Lua treats the "item" segment as a literal table not as a variable.
Any suggestions?