lua-users home
lua-l archive

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


> By any chance, is there a Lua-5.2-compatible implementation of the
> bit32 module written for Lua 5.1?

The simple hack below seems to work (it does compile :) in a 32-bit Linux:

24c24,26
< 
---
> typedef unsigned int lua_Unsigned;
> #define luaL_checkunsigned (lua_Unsigned) luaL_checkinteger
> #define lua_pushunsigned lua_pushinteger
159,160c161,162
< LUAMOD_API int luaopen_bit32 (lua_State *L) {
<   luaL_newlib(L, bitlib);
---
> int luaopen_bit32 (lua_State *L) {
>   luaL_register(L, "bit32", bitlib);