Posted 31 January 2013 - 02:35 PM
Hello, and first thanks for taking the time in reading this.
I am making an inventory system, using turtles in retrieving resources from chests. I am wanting to use a multi-dimensional table to store resources and their respective x,z,amount values.
here is the relevant code with everything else snipped out for easy reading.
Running it I am receiving the error "'<name>' expected" for the inventory.name = {xpos = x, zpos = z} line
I have also tried setting inventory.name to an empty table, then inserting the x and z in separately but that was giving me same error as well.
I am making an inventory system, using turtles in retrieving resources from chests. I am wanting to use a multi-dimensional table to store resources and their respective x,z,amount values.
here is the relevant code with everything else snipped out for easy reading.
-----------------------------------------
-- global variables
-----------------------------------------
inventory = {}
function add_item()
print("name of the item:")
local name = read()
print("x pos")
local x = tonumber(io.read(int))
print("z pos")
local z = tonumber(io.read(int))
inventory.name = {xpos = x,zpos = z}
end
Running it I am receiving the error "'<name>' expected" for the inventory.name = {xpos = x, zpos = z} line
I have also tried setting inventory.name to an empty table, then inserting the x and z in separately but that was giving me same error as well.