lua-users home
lua-l archive

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

On Jul 31, 2008, at 1:42 PM, Luiz Henrique de Figueiredo wrote:

Is there a recipe for compiling everything into a single bytecode file?

"luac *.lua" does that but probably not in the order you need. Moreover, if you use require in your modules, then you need to add a fake require
at the start.

Once one has sorted out the dependencies order, then luac does indeed do The Right Thing (SM) :)

In the case of Nanoki, this looks something like this:

% luac -o Nanoki.luac Cache.lua Config.lua DB.lua Data.lua Diff.lua File.lua Finder.lua HTTP.lua HTTPExtra.lua URL.lua IPLocation.lua MIME.lua NaturalComparator.lua TCPServer.lua Template.lua Token.lua Trie.lua Unidecode.lua Wiki.lua WikiAbout.lua WikiContent.lua WikiContentFileService.lua WikiService.lua WikiContentService.lua WikiControlService.lua WikiDAV.lua WikiDate.lua WikiDateService.lua WikiDateNavigation.lua WikiDiffService.lua WikiFeed.lua WikiFileService.lua WikiFinder.lua WikiIndex.lua WikiIndexService.lua WikiIndexNavigation.lua WikiMainService.lua WikiMessage.lua WikiPath.lua WikiPreview.lua WikiRecent.lua WikiRecentService.lua WikiRevisionService.lua WikiSearch.lua WikiEditorService.lua WikiSearchService.lua WikiVersionService.lua XML.lua base64.lua markdown.lua Nanoki.lua

Which results in one 'Nanoki.luac' file of around 468 KB.

One can then run this all inclusive file to start Nanoki:

% lua Nanoki.luac . 0 1080