|
A.lua: return function(init) local num=init return {print_num=function() print(num)} end B.lua: local A=require("A")(100)
Oh, I just cut it from my code so ... sorry for my mistake.
local num = 1
function print_num() print(num) end
return {print_num = print_num} and Used as: A = require('a') A.print_num() 2014-07-19 22:53 GMT+08:00 Rena <hyperhacker@gmail.com>:
|