You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
370 B
20 lines
370 B
|
2 years ago
|
local _, ns = ...;
|
||
|
|
|
||
|
|
local namespace = {};
|
||
|
|
|
||
|
|
setmetatable(ns,{
|
||
|
|
--__metatable = false
|
||
|
|
__newindex = function(t,k,v)
|
||
|
|
namespace[k]=v;
|
||
|
|
end,
|
||
|
|
__index = function(t,k)
|
||
|
|
return namespace[k];
|
||
|
|
end,
|
||
|
|
});
|
||
|
|
|
||
|
|
-- sometimes lua errors are filled with functions and tables from namespace
|
||
|
|
-- and __metatable does not work for lua errors.
|
||
|
|
-- this should prevent it.
|
||
|
|
|
||
|
|
|