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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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()

Moved to the director sub-forum.

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:

1
2
_G["vars"]={}
_G["warrior"]=0

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

Maybe that is the error youre getting.

Regards,

views:1432 update:2011/10/19 14:58:09
corona forums © 2003-2011