On Mon, May 28, 2007 at 08:12:58PM -0400, Tim Hunter wrote:
I think Jerome's right the the fenv is more suited. I forgot there isn't
a one-shot for sharing the same upvalue among multiple c functions. I
was thinking of luaL_openlib(), but it requires the seed to be in a
table to be shared.
[...]
You have to do more like
lua_pushtable(L)
lua_pushinteger(L, DEF_SEEED)
lua_setfield(L, -2, "seed");
lua_pushvalue(L, -1);
lua_pushcclosure(L, seedfn, 1);
lua_pushvalue(L, -1);
lua_pushcclosure(L, randfn, 1);