Log In  


function _init()
f={}
end

function _update()
add(f,{y=1})
end

function _draw()
cls()
map()
print(f.y,58,58,8)
end

The print displays that that f.y is nil, could somebody please help?



That code doesn't set f.y. It sets f[1] (the next numeric index) to a sub-table with y set to 1. The add() function is basically just a shorter way to do f[#f+1] = value. It's primarily for sequences rather than named variables. f.y can be set directly with f.y = 1.



[Please log in to post a comment]