[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: srlua and other methods
- From: Bradley Smith <gmane@...>
- Date: Thu, 17 May 2007 00:45:36 -0700
Remo Dentato wrote:
Hi!
I was looking for a way to package my C/lua application in a single
executable and the method offered by srlua (thanks Luiz!) is appealing
to me because I could offer to advanced users the ability of modifying
the lua parts and generate a new executable without requiring a C compiler.
It seems however that srlua deals with a single lua file while I have
some modules and lua files that use "require()" to load them.
I've seen the version from Frank Bechmann that allows multiple files to
be stored in a zip file (srluaz) but my compiler chokes on unzip.h (part
of zlib?) and I would avoid introducing another dependency.
I could change the original srlua to make it handle multiple lua files
but before doing that I would ask:
1) Has anyone an alternative method to suggest?
This is not a great alternative, but it is something I've found to work
in simple cases. Compile all modules together and then glue the binary
to srlua. The modules must be ordered by dependency in the compile
command, and the modules can't use "module(...)".
luac -o test.lub a.lua test.lua
glue.exe srlua.exe test.lub test.exe
----- test.lua -----
require("a")
print("hello again from inside "..arg[0])
for i=0,table.getn(arg) do
print(i,arg[i])
end
print(a.hello())
print"bye!"
----- a.lua -----
local print = print
module("a") -- Note "module(...)" won't work here
function hello()
print("hello from module")
end