[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [lua] lua2c almost rules!
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 24 Jan 2002 19:53:16 -0200
>function IndexTagMethod(logger,event)
> return function (self, parms)
> self:log(%event, parms)
> end
>end
I'm sorry, but lua2c does not handle anonymoous functions and upvalues.
There's no way to create an anonymous function using the API: you need to create
a static C function first and then register it.
I;ll see if I can come up with a simple solution for this.
In any case, I do not see lua2c (yet) as a general tool: right now it excels
at code fragments, not complete Lua programs.
>what does the MOVE operation do
You seem to be running luac from 4.1 not from 4.0. lua2c only understands
the output of luac from 4.0 (but the generated code should work in 4.1).
For the body of your code, I get
/*
return function (self, parms)
self:log(%event, parms)
end
*/
/* -------------------------------------------------------- */
lua_pushXXX(L,self);
lua_pushstring(L,"log");
lua_gettable(L,-2);
lua_insert(L,-2);
#error cannot handle PUSHUPVALUE
lua_pushXXX(L,parms);
lua_call(L,2,0);
/* -------------------------------------------------------- */
Perhaps it's a start.
--lhf