Hi All,
I was wondering if there was a simple and efficient way to pass parameters to modules (like constructor methods in languages such as Java).
Before I say anything else, YES, I have done my homework by googling this. Specifically I visited pages including
http://lua.2524044.n2.nabble.com/require-passing-arguments-to-module-td6964798.html
and
which were somewhat insightful, but did not really get the job done for me.
Below is what I would like to achieve (which probably won’t compile):
<a.lua>
b = require("b", "foo","bar") print(b.var1) -- should print "foo" print(b.var2) -- should print "bar"
<b.lua>
local var1, var2 = ...
If you could provide actual functional code that would be great!
Thanks in advance! 