[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANNOUNCE] lua2c, convert Lua code into C
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 24 Jan 2002 16:34:22 -0200
I've followed Russell Webb's suggestion and wrote a Lua -> C converter.
You can get it at ftp://ftp.tecgraf.puc-rio.br/pub/lhf/lua2c.tar.gz .
lua2c does not understand arbitrary Lua programs but is pretty useful.
Here is what it does to an example in the reference manual:
In Lua:
a,b = f("how", t.x, 4)
In C:
lua_getglobal(L,"f");
lua_pushstring(L,"how");
lua_getglobal(L,"t");
lua_pushstring(L,"x");
lua_gettable(L,-2);
lua_remove(L,-2);
lua_pushnumber(L,4);
lua_call(L,3,2);
lua_setglobal(L,"b");
lua_setglobal(L,"a");
Please send comments, suggestions, and bug reports directly to me.
Enjoy.
--lhf