Trouble with global variables in Director Class :(

Whenever I input this global function it always gives me this error:
Director ERROR: Failed to execute new( params ) function on ‘home’.
This is my code in Main.lua

display.setStatusBar( display.HiddenStatusBar )  
  
--====================================================================--  
-- DIRECTOR CLASS SAMPLE  
--====================================================================--  
  
--[[  
--]]  
  
--====================================================================--  
-- IMPORT DIRECTOR CLASS  
--====================================================================--  
  
local director = require("director")  
  
--====================================================================--  
-- CREATE A MAIN GROUP  
--====================================================================--  
  
local mainGroup = display.newGroup()  
  
--====================================================================--  
-- MAIN FUNCTION  
--====================================================================--  
  
local main = function ()  
  
\_G["vars"]={}  
\_G["warrior"]=0  
  
 ------------------  
 -- Add the group from director class  
 ------------------  
  
 mainGroup:insert(director.directorView)  
  
 ------------------  
 -- Change scene without effects  
 ------------------  
  
 director:changeScene("menu")  
  
 ------------------  
 -- Return  
 ------------------  
  
 return true  
end  
  
main()  

This is my code in troops.lua (it is a popup that adds to the variable:

local function pressWarrior (event)  
if event.phase == "ended"   
then   
print('added one')  
\_G["warrior"]=\_G["warrior"]+10  
end  
end  

And finally this is where the actual image is summoned:

[code]
local warrior = _G[“warrior”]

if(warrior > 0) then
warrior = display.newImage(‘images/warrior.png’, 480, 320)
end
_G[“warrior”]=warrior
localGroup:insert( warrior )
[/code] [import]uid: 34097 topic_id: 16258 reply_id: 316258[/import]

Moved to the director sub-forum. [import]uid: 52491 topic_id: 16258 reply_id: 60503[/import]

I’m going to take a stab in the dark but I think (at least one) of your problems has to do with how you set up your tables.

I don’t think you can have strings (correct name here?) as index’s for tables, so this:

\_G["vars"]={}  
\_G["warrior"]=0  

Should look probably something like this:

\_G[vars]={} \_G[warrior]=0 [import]uid: 23649 topic_id: 16258 reply_id: 60509[/import]

Even being newbie I agree with the mention of @Jeremy.

Maybe that is the error youre getting.
Regards, [import]uid: 89165 topic_id: 16258 reply_id: 60558[/import]