Convert LUA to C! IT WORKS!!!!!!!!

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
sg57
Posts: 144
Joined: Fri Oct 14, 2005 2:26 pm

Convert LUA to C! IT WORKS!!!!!!!!

Post by sg57 »

YAY! Theres this tool in the actual Windows LUA Distribution called: bin2c
Its only but the source of it, so i messed with it a bit to print the Array of bytes to a file, thus converting the LUA to C, so ican use the:

luaL_loadbuffer(lua_State *L, const char *buff, size_t sz,
const char *name);
Call to convert those bytes to C via the intrepter...

what im asking here though, is... In order for me to use this, do i have to include all of the LuaPlayer source and what not?

Or just make sure i can complie what LuaPlayer was complied with...

I think there is 1 more function im looking for... since i heard u must use the lua_dobuffer to actually get it running...

Any thoughts on converting LUA to C anybody? Besides old fashion way?
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

are you sure "bin2c" doesnt simply read a binary and outputs an array in C syntax (and thus doesnt really have anything to do with LUA) ? :=P
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

hehe but he is so close ....fact is you cannot convert
a script language like LUA into a high level language like C
10011011 00101010 11010111 10001001 10111010
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

uhm, it might actually be doable... LUA is kindof typeless C afterall. probably not easily possible without (a lot of) manual editing though :)
ufoz
Posts: 86
Joined: Thu Nov 10, 2005 2:36 am
Location: Tokyo
Contact:

Post by ufoz »

It's probably storing some form of compiled lua bytecode, I thought this was always possible if you didn't want to keep text scripts around? It's been a while since I touched the lua sdk... (obviously you still need the interpreter/environment, duhh)
User avatar
lokust
Posts: 22
Joined: Sun May 28, 2006 7:34 am

Post by lokust »

ufoz wrote:It's probably storing some form of compiled lua bytecode, I thought this was always possible if you didn't want to keep text scripts around? It's been a while since I touched the lua sdk... (obviously you still need the interpreter/environment, duhh)
Yeah, supposedly you can pre-compile your lua scripts and load them at run-time. But really, nine times out of ten wouldnt it be easiest (and most likely safer) to just convert it manually to c?
Post Reply