Log In  


someone can help me with this?

objs={
player={
upd=function()
--function
end
}
}

function _update()
for i=1,#objs do
objs[i].upd()
end
end

idk with its not working, i tried on normal lua and it worked



I suspect the "normal lua" version was slightly different. What you posted shouldn't work.

The issue is that upd is in the subtable at "player", not at any integer index.


2

You have a couple of things going on here. First, you are treating objs like a table that contains other tables, but to do that, you need to either wrap that player= block in its own set of braces, or remove the player= altogether. And if you wrap the player= block in braces, you'll have to change your loop to use objs[i].player.upd() because the upd() function will be a member of player and not objs[i] directly.



[Please log in to post a comment]