You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if it's a bug or me being fresh to Lua, but it looks like there was a change in Lua5.2+ and there is no lua_objlen function anymore. Insted there is lua_len, which pushes the result onto the stack.
size_t lua_objlen (lua_State *L, int index);
Returns the "length" of the value at the given acceptable index: for strings, this is the string length; for tables, this is the result of the length operator ('#'); for userdata, this is the size of the block of memory allocated for the userdata; for other values, it is 0.
void lua_len (lua_State *L, int index);
Returns the length of the value at the given index. It is equivalent to the '#' operator in Lua (see §3.4.7) and may trigger a metamethod for the "length" event (see §2.4). The result is pushed on the stack.
The text was updated successfully, but these errors were encountered:
Ahh Ok found it. I probably should call Lua.len in this case. Sorry my bad. Both of this functions are available, but in Lua5.2+ i have to remember to call the right one.
Hey! Yep, there are several things that change between versions of Lua.
We recently made a big change (#54) that merged all of the separate Lua language targets into a single lib file. The documentation still needs work though, so sorry for any confusion you might find while we work on that :) Thanks for asking, no need to feel bad!
And as a note, the function in lua 5.2+ that is most similar to lua_objlen is lua_rawlen.
Hello there.
Not sure if it's a bug or me being fresh to Lua, but it looks like there was a change in Lua5.2+ and there is no
lua_objlen
function anymore. Insted there islua_len
, which pushes the result onto the stack.Lua5.1 Docs
Lua(5.2, 5.3, 5.4) Docs
The text was updated successfully, but these errors were encountered: