Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rawlen usage makes extension incompatible with LuaJIT-based implementations #63

Open
tsafin opened this issue Jul 8, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tsafin
Copy link

tsafin commented Jul 8, 2022

Tarantool as database, and application server uses LuaJIT for Lua support in appserver. By default it's compiled without LUAJIT_ENABLE_LUA52COMPAT defined thus rawlen is inaccessible in majority of a cases.

This is kinda worked around in a code via

// Lua 5.2+ versions
declare function rawlen<T extends AnyTable>(this: void, v: T | string): number;
...
export const luaRawLen = rawlen ?? function<T extends AnyTable>(v: T | string): number {
}

which is translated to Lua as

____exports.luaRawLen = rawlen or (function(v)
...
end)

But this is not working either if strict mode enabled (which is default for Debug build here).

P.S.
It should probably wrapped in rawget.

@tsafin tsafin changed the title rawlen usge makes extension incompatible with LuaJIT-based implementations rawlen usage makes extension incompatible with LuaJIT-based implementations Jul 8, 2022
@tomblind tomblind added the bug Something isn't working label Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants