lua-users home
lua-l archive

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


Hi Luiz, all,

I've done like you suggested, now the Lua file 'lmathlib.c' is unchanged. I've changed only my top-level file, gsl-shell.c in order to charge the math library as you suggested, thank you very much.

So, now GSL shell just use a vanilla copy of Lua 5.1.4 with LNUM patch, I don't know if this help in order to put it LuaDist. For me there are two possible utilisation of GSL shell:
- as a stand-alone program => in this case a top-level program charges all the needed
  library. In this case we can collapse the math and gsl functions in the common namespace
- as a normal lua library => in this case a separate namespace is used for gsl and math
   functions. I've already integrated this possibility in the software with the FLAG
   USE_SEPARATE_NAMESPACE in defs.h

For me it would be nice if GSL Shell can be made available as a library to Lua users even in my main goal in the stand-alone program.

Francesco

2009/10/3 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>
> Basically, you may do
>
>   for k,v in pairs(math) do _G[k] = v end

In C that could be simpler:

  lua_pushvalue(L,LUA_GLOBALSINDEX);   /* open math in global scope */
  lua_setglobal(L,LUA_MATHLIBNAME);
  luaopen_math(L);
  lua_pushnil(L);                      /* remove math */
  lua_setglobal(L,LUA_MATHLIBNAME);

This is what my ae does:
       http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#ae