I cannot seem to get methods to work while using the director class. I’m trying to load my methods from and external file like so…
external_module.lua
[lua]module(…, package.seeall)
function obj:iSetup()
end[/lua]
current_scene.lua
[lua]module(…, package.seeall)
function new()
local localGroup = display.newGroup()
local setup = require(“external_module”)
local obj = display.newGroup()
localGroup:insert(obj)
obj:iSetup()
return localGroup
end[/lua]
I keep getting the error, “attempt to index global ‘obj’ a nil value.” I’ve tried everything I can think of but director doesn’t want to recognize my method. Are you able to use director with methods and external modules??? I would greatly appreciate your help with this. Thank you. [import]uid: 53766 topic_id: 15009 reply_id: 315009[/import]
then you will get an idea, the problem is in both the files
in external_module.lua, change line 3 to function iSetup()[/code]then in current_scene.lua change the line 12 to setup:iSetup()[/code]that should not give you an error and work.You might still want to read on those three links to get an idea and understanding about external functions.cheers,?:) [import]uid: 3826 topic_id: 15009 reply_id: 55462[/import]