lua-users home
lua-l archive

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


> > I just can't seem to get it to work with sub modules, e.g. if I require
> > "tek.ui" in my program.
> 
> Oops, this is a bug in luac.lua. I'll work on a fix. Thanks for the report.

Actually, this is more a conceptual problem than a bug. Should luac.lua
treat file paths as (sub)module paths? The current version does not; it
just strips the path and leaves the file name, without the extension.
Here's a patch that makes luac.lua treat file paths as (sub)module paths:

32c32,33
< 	b=b..string.gsub(arg[i],"^.-([^/]+)%.lua$","t['%1']=function()end;\n")
---
> 	local p=string.gsub(arg[i],"/",".")
> 	b=b..string.gsub(p,"^.-([^/]+)%.lua$","t['%1']=function()end;\n")

but then you lose the ability to put modules anywhere in your filesytem.
I don't see a way of having both.

It's a good thing that luac.lua is written in Lua and so is easy to customize.

I hope it helps.
--lhf