So I'm working on a inventory system and I dont know how I can call the tables inside a table and the variables.
Heres the tables in the modulescript I'm trying to call.
local items = { ----||Item 1|||---- {name = "Item1", itemid = "000000f", itemweight = 0, }, ----||Item 2|||---- {name = "Item2", itemid = "0000007", itemweight = 0, }, ----||Item 3|||---- {name = "Item3", itemid = "00200FF", itemweight = 0, }, } return items
I only really know how to call Items but not the tables in it, or their variables. How can I do this?
Like this:
local module = require() --your module local itemInt = 1 --this depends on which item you want to use. print(module[itemInt]) -- will print out a table, print(module[itemInt].name) --will print out the name print(module[itemInt].itemid) --will print out the id print(module[itemInt].itemweight) --will print out the itemweight.