[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Suggestion, Lua Sizes
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 17 Feb 2012 09:26:52 +0200
On Fri, Feb 17, 2012 at 12:30 AM, Jay Carlson <email@example.com> wrote:
> 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.
That's very cool. Yes, mea culpa, pl/init.lua is a devious piece of code.
For those unfamilar with the strategy, it does lazy loading of
modules. This is to make life easier for lazy programmers:
local d = arg or error 'provide a directory'
if path.isfile (d) then
for f in dir.dirtree(d) do
require 'pl' does not actually bring in the whole 10K of the complete
library, but defines the subtables like 'path', 'dir', etc with a
custom __index. If you try to access a function in path it will do a
require 'pl.path' on demand.
Needless to say, this is a terrible thing to inflict on tool writers.