[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [patch] dynamically link liblua to luac
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 7 Dec 2008 18:17:48 -0200
> In the below patch, I modified luac.c to take an approach somewhat
> like the luac.lua above, eliminating the dependencies on internal
> functions in the Lua library.
I did something similar as a proof-of-concept when I was writing luac.lua;
see the code below. With this change, luac.c no longer depends on *any*
internal function, except luaU_dump. It still need access to the contents
of L, though.
static const Proto* combine(lua_State* L, int n)
for (i=0; i<n; i++) lua_pushliteral(L,"(function()end)();");
luaL_loadbuffer(L,lua_tostring(L,-1),lua_objlen(L,-1),"=(" PROGNAME ")");
for (i=0; i<n; i++) f->p[i]=toproto(L,i-n-2);
This version of combine is really much easier to read, maintain, and hack.
Let's see what happens to luac in 5.2...