lua-users home
lua-l archive

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

Hi all,

My extended globals-checking tool has grown up and has collected many
more lines and a write-up:

There is a test directory, just run 'lua test.lua'  or 'lua52 test.lua
luac52' (if that's what your 5.2 luac is called)

It's generally coping with grown-up code like Penlight, but issues are
likely to remain.  If it breaks on Lua 5.2, it's a bug.

It _does_ do multiple files now and wildcards, even on Windows.

The cool new feature is the -x flag which does local alias analysis,
both for requires and the module itself.

-- new.lua: plain-jane module style for 5.1/5.2 compatibility
-- tracks both require and module local aliases
local lfs = require 'lfs'
local new = {}


function ()
    return new.two()

function new.two ()
    return 42*new.fiddle_factor

return new

$ lglob -x new.lua
lglob: new.lua:13: undefined get new.fiddle_factor

Still does explicit loading of modules with require(), which is less
than ideal solution. I would be interested in proposals on how to
improve on this - my thoughts are to train lglob to extract whitelists
from modules and use these when require() is found in code.

Thanks to David Manura, author of the original globalsplus.lua, Egil
Hjelmeland's inspiring and useful globals utility, and the one and
only Kein-Hong Man's No Frills Introduction to the Lua VM. And also to
Luiz who accidently let slip that 'luac -l -l' gives a _lot_ of
interesting information.  My job was mostly being chief librarian and

steve d.