hello, for a game i need a count but the table doesnt accept a value without a object (display.new…)
is there a way to make a table without specialy an object ?
local level = {} level[1] = 1 level[1].time = 60 level[2] = 2 level[2].time = 30 local function printime(b) if level[b].time \> 0 then level[b].time =level[b].time-1 print(level[b].time) return level[b].time end if level[b].time == 0 then print("gameover") end end timer.performWithDelay( 1000, printime(1),-1)
>>>> attempt to index field ‘?’ (a number value)
this works but i dont want this :
local level = {} level[1] = display.newRect(100,100,100,100) level[1].time = 60 level[2] = display.newRect(100,100,100,100) level[2].time = 30

Thanks