“foo.lua”文件:
function foo (x)
print(x)
end
function honghong()
print("honghong")
end
--主lua文件
function dofile (filename)
local f = assert(loadfile(filename))
return f()
end
dofile("foo.lua")
foo("hello")
honghong()
“foo.lua”文件:
function foo (x)
print(x)
end
function honghong()
print("honghong")
end
--主lua文件
function dofile (filename)
local f = assert(loadfile(filename))
return f()
end
dofile("foo.lua")
foo("hello")
honghong()