local ItemInformation = { Rock = {'Tool'}, WoodSword = {'Weapon'}, WaterBottle = {'Food'}, IronSword = {'Weapon'}, Spear = {'Weapon'}, IronAxe = {'Tool'}, StoneAxe = {'Tool'}, Bow = {'Weapon'}, Stone = {'Basic'} } for _,i in ipairs(ItemInformation) do print(i) end
No error, no printing. It's really pissing me off..
fun fact: ipairs()
stops when a first nil value is reached. (technically a dictionary has infinite nil values in no particular order). simply use pairs()
local ItemInformation = { Rock = {'Tool'}, WoodSword = {'Weapon'}, WaterBottle = {'Food'}, IronSword = {'Weapon'}, Spear = {'Weapon'}, IronAxe = {'Tool'}, StoneAxe = {'Tool'}, Bow = {'Weapon'}, Stone = {'Basic'} } for k,v in pairs(ItemInformation) do print(v[1]) --you used tables as your values so you will have to index them. If you don't need t tables, remove all of the `{}` above and remove the `[1]` end