I am coming to terms with the whole external module thingy.
and I was just wondering am I totally bastardizing the last function ?
I created a table in the last function helloWorld3 inside of the external module(example.lua)
that I want to pass back to the main,lua.
I did it, but the way I did is kindof funky looking.
See the below assignment —> local “abc”
My question is, Should I be using a different syntax for this “call”
and how would the proper cleanup/garbage collection ? abc = nil
OK, here is the main.lua code
[lua]-- main.lua
local example = require( “example” )
local hel = example.helloWorld
hel() – output
print(type(hel))
local lo = example.helloWorld2
lo() – output
print(type(lo))
local abc = example.helloWorld3
print(abc()[1] )[/lua]
OK, here is the example.lua code
[lua]-- example.lua
module(…, package.seeall)
function helloWorld()
print( “Hello” )
end
function helloWorld2()
print( “World” )
end
function helloWorld3()
local troy = {}
troy[1] = 10
–print (troy[1])
return troy
end[/lua]
[import]uid: 11094 topic_id: 18875 reply_id: 318875[/import]
[import]uid: 64174 topic_id: 18875 reply_id: 72756[/import]