Reputation: 39
Hello,
I was wondering, is there any possible way to make a lua script that contains one (or more) functions that you can "return" them, and require with another lua script?
I tried this, but didn't work
Functions
Func = {
function test(a)
print(a)
end
}
return Func
Main Code
require(FUNCTIONS_PATH)
It gives an error on that point (probably because the code is totally wrong). I would like some help on that.
Thank you.
Upvotes: 1
Views: 347
Reputation: 48672
Separate the name from function
, like this:
Func = {
test = function(a)
print(a)
end
}
return Func
Upvotes: 3