lua-users home
lua-l archive

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


>>From: Samson, Lyndon [IT]
I wonder how easy it would be to introduce namespaces/packages?


Could the dofile command be expanded to dofile(filename, table) and the
table passed used as the global table for executing the file?
eg.
String = {}
dofile("stringlib.lua",String)
x = String.strlen("a string")

Could a "using" keyword be added to jump into a table scope?
eg.
using String do
x = strlen("another string")
end

I assume the above would check any local and "used" scopes before checking
globals?

N