lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, May 8, 2019 at 5:08 PM Markus Koskimies <mkoskim@gmail.com> wrote:

> lua_rawgeti(L, LUA_REGISTRYINDEX, r);

I suspect this is a bug in DerelictLua.

Lua defines lua_rawgeti thus:

int lua_rawgeti (lua_State *L, int index, lua_Integer n);

While DerelictLua defines its binding thus:

alias da_lua_rawgeti = int function(lua_State*, int, int);

Note that the last parameter is of a different type. I would guess the Lua DLL that you use was built using the "stock" config, where lua_Integer is a 64-bit integer, while D's int is always a 32-bit value. Your 64-bit Linux will use register-based ABI, where this does not matter, while 32-bit Windows will use stack-based ABI, which makes all the difference.

This should fix the problem:

alias da_lua_rawgeti = int function(lua_State*, int, long);

You might want to check all the bindings, though.

Cheers,
V.