lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2014/7/31 16:18, Dirk Laurie wrote:
2014-07-31 10:09 GMT+02:00 albert_200200 <albert_200200@126.com>:

Hi, I test with your method, but I have no lucky, Can you point where am I
wrong?
I wrote the code below:
foo.lua
-----------------------------------------------------

local M = {}
local function add_internal(a, b)
     return a+b
end
local function multiply_internal(a, b)
     return a*b
end
function M.add(a, b)
     return add_internal(a, b)
end
return M

test.lua
--------------------------------------------------------
local foo, myprivate = dofile("./foo.lua")
myprivate.add_internal(1, 2)

But I have no lucky, myprivate is nil.
return M,{add_internal=add_internal,multiply_internal=multiply_internal}

Thanks, this is tricky. ^_^