forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Thu Jun 15, 2006 3:39 pm    Post subject: Convert LUA to C! IT WORKS!!!!!!!! Reply with quote

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?
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Thu Jun 15, 2006 6:32 pm    Post subject: Reply with quote

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
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Thu Jun 15, 2006 7:17 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Thu Jun 15, 2006 9:06 pm    Post subject: Reply with quote

uhm, it might actually be doable... LUA is kindof typeless C afterall. probably not easily possible without (a lot of) manual editing though :)
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
ufoz



Joined: 10 Nov 2005
Posts: 86
Location: Tokyo

PostPosted: Thu Jun 15, 2006 9:38 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
lokust



Joined: 28 May 2006
Posts: 22

PostPosted: Thu Jun 15, 2006 10:18 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group