lua-users home
lua-l archive

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


> Anyway, the first portability fix would be to make the same code compile 
> against Lua 5.1 and 5.2 like a lot of other modules:
> 
> LUALIB_API int luaopen_mathx(lua_State *L)
> {
> #if LUA_VERSION_NUM <= 501
>  luaL_register(L,LUA_MATHLIBNAME,R);
> #else
>  lua_getglobal(L,LUA_MATHLIBNAME);
>  luaL_setfuncs(L,R,0);
> #endif

Have you checked lmathx for 5.1? It does that already:
	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz
 
> For Visual Studio 2010 and 2012, the following warnings and errors are 
> generated.  I don't know what you would do to fix them.

If these compilers support C99 math functions then there is probably
a switch somewhere. Note how I've used
	#define _GNU_SOURCE 1
so that it works in Linux, which is probably not optimal but worked on
the systems I tested.