lua-users home
lua-l archive

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


On Mon, Feb 13, 2012 at 5:25 AM, steve donovan
<steve.j.donovan@gmail.com> wrote:

> Most of us have toolboxes of convenient functions, and
> they get used in any non-trivial project. Like functions to split
> strings into tables.  I still do this because I don't want to burden
> every one of my public projects with Penlight.

[...]

> An interesting possibility is 'static linking' of Lua programs; tools
> like Squish[1] point the way here.

Squish was too complex for me. See and/or seize
http://place.org/~nop/soar-0.0.tar.gz which does static/dynamic
dependency analysis, and creates the expected chunk form:

local function _main()
require "ml"
require "loml"
<body of script goes here>
end
package.preload["ml"] =function()
<body of ml>
end
package.preload["loml"=...
end
_main()

...except with more junk around it for various good and not so good
reasons (setenv UNSOAR to get the original script back on stdout etc.)
I blame pl/init.lua for the dynamic analysis, but it does seem to get
penlight apps right if you can hit all the code paths.

Between soar and Squish, "I want to ship a single .lua file" is no
longer a reason to be cut&pasting code into your apps.

Jay

> [1] http://matthewwild.co.uk/projects/squish/home