lua-users home
lua-l archive

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

> I was trying to load a library lib from a folder named test, so
> $ lua -l test.lib
> But then, how to access the loaded library in the interpreter?
> [...]
> I figured I could use the global _G variable,
> > _G['test.lib'].myfun()
> 42
> But is there no more elegant way to do this? Would it not have been good if
> the directory name was not included in the variable name? Any idea?

Indeed, this is not particularly convenient, but currently it is the
only way. In the old days, Lua would create a table 'test', so we could
write 'test.lib'; but I am not sure this is worth the extra complexity.

-- Roberto