[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [lua] lua2c almost rules!
- From: Paul Swanson <pswanson@...>
- Date: Thu, 24 Jan 2002 13:16:01 -0800 (PST)
Wow, that was fast work on lua2c, and it came just in time for my project.
I just sat down today to translate this bit of lua into C by hand:
function IndexTagMethod(logger,event)
return function (self, parms)
self:log(%event, parms)
end
end
(this allows 'log:EVENT { data1 = "abc", ... }')
First, I ran it through lua2c:
...
#error cannot handle CLOSURE
lua_setglobal(L,"IndexTagMethod");
return -1;
#error cannot handle MOVE
#error cannot handle CLOSURE
return 0;
return 2;
#error cannot handle SELF
#error cannot handle LOADUPVAL
#error cannot handle MOVE
lua_call(L,-1,3);
return 5;
I didn't expect it to work, since this is fairly complicated. It
doesn't have any control flow or arithemetic operations though, so maybe
this will be a good test case for rev2 :) what does the MOVE operation
do, anyway?
Well, keep up the good work, and I'm off to try to figure out how to do
this by hand again. If anyone has any suggestions, I'd be happy to
explore them, as I don't really know where to start with this one.
Paul