lua-users home
lua-l archive

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


It was thus said that the Great Soni L. once stated:
> On 12/06/16 09:57 PM, Sean Conner wrote:
> >	local mt_reqpath = {}
> >
> >	function my_reqpath:__index(key)
> >	  table.insert(self.path,key)
> >	  return self
> >	end
> >
> >	function my_reqpath:__call(...)
> >	  table.insert(self.path,1,self.base)
> >	  local path = table.concat(self.path,".")
> >	  self.path = {}
> >	  return require(path)
> >	end
> >
> >	function reqpath(path)
> >	  return setmetatable(
> >		{ base = path , path = {} },
> >		my_reqpath
> >	  )
> >	end
> Doesn't seem like this would work
> 
> local soniex2 = reqpath"io.github.soniex2"
> local a = soniex2.a()
> local bpath = soniex2.b
> local c = bpath.c()
> local b = bpath()
> -- ??? what happens here?

  Did you try it?  What should happen there?  

> Why are you? :P

  I have no idea ... 

  -spc (Must be a slow Sunday ... )