Skip to content

Lua 5.4 - 'cimport' has no member named 'lua_objlen' #58

@b4rti

Description

@b4rti

Hello there.

lib/ziglua/src/lib.zig:1345:17: error: root struct of file 'cimport' has no member named 'lua_objlen'
        return c.lua_objlen(lua.state, index);

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.

Lua5.1 Docs

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.

Lua(5.2, 5.3, 5.4) Docs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions