lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi!

I am currently trying to find out how I could possibly add new built-in functions into a compiled game that uses Lua for certain game mechanics. I do not know a lot about Lua except that it's running a VM basically that is acting as a interpreter for the actual Lua scripts to be executed.

Since I am at the very beginning of my "journey" here I hope to find answers to a few questions here. First of all the game I am talking about is Supreme Commander - some of you might know it. All I know is that it's using Lua 5.0 and I think the developers threw some stuff out which they didn't want in the game and compiled it. What I don't know is whether the Lua part is residing inside the executable or if it's in a DLL. My first guess would be the executable because browsing it with a hex-editor revealed that all the built-in function names reside somewhere in the data section of the executable.

I don't know if anybody can actually help me with this but I am currently a bit stuck and I don't really know how Lua is written into the executable. What I can imagine is that there must be some sort of lookup table for all the built-in functions. As the interpreter finds e.g. "dofile" it has to look up the address of the function in order to jump to its actual location. Anything that can help me to find out where or how I have to look after this would be helpful.

I hope my question is not off-topic and that somebody can give some advice or inspire a few things I could try. Feel free to ask me if anything I explained is not clear. There is also a question [1] on stackexchange from me which you can check out if you want.

Thank you for any help!

BR; Stefan

[1] http://reverseengineering.stackexchange.com/questions/14091/hacking-lua-introduce-new-functions-into-built-lua