[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: srlua and other methods
- From: Remo Dentato <rdentato@...>
- Date: Thu, 17 May 2007 15:50:25 +0000
Thanks for the suggestion of using luac (I hadn't thought at luac at all!) and I hope the Lua Gems will be published soon (is there any place where they are stored in draft form?).
Unfortunately I've no time at the moment to create a generic solution so I decided to take a shortcut :)
I wrote a small merge program (see code below) that takes the source files (in dependency order) and emits a single lua file whose execution loads the libraries in the correct order and then executes the main code.
To make the module/require work, each module is enclosed in a function and then execute it (as if it was loaded by dofile())
__xx = function (...)
... MODULE CODE ...
end
__xx()
then I can compile it with luac and use srlua to create a single exe file.
Quick and dirty but works for me :)
-------------------------------
function copy(fname)
f = io.open(fname)
if f then
io.write(f:read("*all"))
f:close()
end
end
for n=1,#arg-1 do
io.write("__xx=function(...)\n")
copy(arg[n])
io.write("end\n")
io.write("__xx()\n")
end
io.write("__xx=nil\n")
copy(arg[#arg])
-------------------------------
Connect to the next generation of MSN Messenger Get it now!