lua-users home
lua-l archive

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

On Wed, Mar 18, 2009 at 2:49 PM, Timm S. Mueller
<> wrote:
> On Wed, 18 Mar 2009 18:35:27 +0100
> Ben Aurel <> wrote:
>> One question not fully related to tekui: do you know a solution to
>> deploy a program in a single self executable .exe? Scripts and
>> interpreter in one exe?
> If I'm not mistaken, you need to find a way to convert your script (or
> bytecode) to a binary object, which can then be linked to your
> application. How this is best achieved is specific for your compiler or
> toolchain. Next, you use Lua's C API to create an interpreter state,
> and then lua_load() with an appropriate reader callback to load your
> initial script from memory. Finally, you can run it using lua_pcall().

wxLua builds an executable that allows scripts to be appended to it as
they are without any recompiling. You run a Lua program with the name
of the wxLuaFreeze executable and the name of your Lua script to be
appended and it generates some magic code placed at the end of the new
program. When the wxLuaFreeze executable is run it looks for the magic
at the end which tells it the length of the appended script and then
loads and runs that. It's simple and easy, but only works for single
file Lua programs. As they say, your mileage may vary.