love2d - Lua how to assign default array value to '0' not nil -


i getting lately error in lua saying cannot assign arithmetic value of '?'. realized need define how many storage in array , assigning them value,

this gave me error : locator = {}

this worked fine : locator = {0,0,0,0,0,0,0,0,0,0}

so have array need loop store 200 values in it, how define storage , values within without : = {0,0,0,0,0,...... etc}

any ideas ?

this worked me :

locator = {}  = 1, 200  locator[i] = 0  end 

just assigning 0 inside loop before using them

credits : egor skriptunoff


Comments