Export global table only if "module()" is defined.

This commit is contained in:
Diego Nehab 2013-06-05 18:36:51 +08:00
parent b1d1e721d1
commit bc709ac7b7
2 changed files with 24 additions and 21 deletions

View file

@ -10,9 +10,10 @@
local string = require("string")
local table = require("table")
local base = _G
ltn12 = {}
local _M = ltn12
local _M = {}
if module then -- heuristic for exporting a global package table
ltn12 = _M
end
local filter,source,sink,pump = {},{},{},{}
_M.filter = filter
@ -294,4 +295,4 @@ function pump.all(src, snk, step)
end
end
return _M
return _M