add use function to standard lib

This commit is contained in:
Evgeny
2021-08-26 11:05:52 +03:00
parent b3b6276087
commit e10a33a3b1

View File

@@ -55,3 +55,13 @@ function round(x, n)
if x >= 0 then x = math.floor(x + 0.5) else x = math.ceil(x - 0.5) end
return x / n
end
function use(module, ...)
for k,v in pairs(module) do
if _G[k] then
io.stderr:write("use: skipping duplicate symbol ", k, "\n")
else
_G[k] = module[k]
end
end
end