lua-users home
lua-l archive

Re: bit32 for Lua 5.1?

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


> Here's a version of the bit32 library from 5.2.0-alpha, fully back- 
> ported
> to 5.1.4, with all the needed #defines and such:
> 
> http://smbolton.com/lua/lbitlib-5.2.0-alpha-backport1.c
To avoid having to edit much of the original code, I suggest adding the
defines below to your define section at the top:
#define LUAMOD_API
#define LUA_BITLIBNAME	"bit32"
#define luaL_newlib(x,y) luaL_register(x,LUA_BITLIBNAME,y)
Also, please preserve the RCS Id line so that we know which version it uses.
lua_pushunsigned can be static.
Perhaps it would be easier to pack all backport code into a lbitlib.h and
just add one line to lbitlib.c, ideally at the very top:
#include "lbitlib.h"

AltStyle によって変換されたページ (->オリジナル) /