diff -r 219d7a7304f8 -r 038275cd92ed lgen.lua --- a/lgen.lua Sun May 07 20:02:53 2017 +0100 +++ b/lgen.lua Tue Jan 16 16:39:48 2018 +0000 @@ -1,16 +1,20 @@ - -module('lgen', package.seeall) --- export src dst hierarchy + +local path=string.gsub(arg[0], "(.*)/[^/]*", "%1"); +if path~=nil then + package.path=package.path .. ';' .. path .. '/?.lua' +end -- Lua 5.1 setfenv/getfenv compatibility for Lua 5.2 local CE = require('compat_env') _G.setfenv = CE.setfenv _G.getfenv = CE.getfenv -require('scan') -require('handlers') +local scan=require('scan') +local handlers=require('handlers') -- globally add missing stuff -require('luaext') +local luaext=require('luaext') +local lfs=require('lfs') +local path=require('path') -- -- Main @@ -20,12 +24,13 @@ error("Usage: lgen src tmpl dst") end -src = arg[1] -tmpl = arg[2] -dst = arg[3] +local src = arg[1] +local tmpl = arg[2] +local dst = arg[3] print('Scan...') -hierarchy = scan.scan(src) + +local hierarchy = scan.scan(src) local env={