[SOLVED] variable params?

In Director 1.3 you can use params, like:

1
director:changeScene( { level="1" } , "level", "crossFade" )

@rmbsoft,
I guess you need to read up a bit on tables.

what you are after can be achieved as

local test = {}
test["level"] = "1" --

now pass this to director

director:changeScene( test, "level", "crossFade" )

to change it, just use test.level = "2"
or test.level = "whatever you want"

hope that was what you were after...

cheers,

?:)

Hi,

I tried that, but the level= parameter is still not detected in level.lua

what did you try mate?

you have tried this code,

1
2
3
4
local test = {}
test["level"]="1"
 
director:changeScene( test, "level", "crossFade") 

and should the file level.lua receive the parameters?? I need to look at the new version of Director.

cheers,

?:)

How can you make level="1" variable?

num = '"1"' <-- double quotes and single quotes on outside
level = "level="..num

I tried this:

1
2
3
4
local test = {}
test["level"]="1"
                        
director:changeScene( { test } , "level", "crossFade" )

@rmbsoft,
Mate, see you are not copying the code I send you, you are trying to modify it your way. I said read up on tables.

I ask you to pass the table test as ( test, "level"...)
but you keep sending it as ( {test}, "level" ... )

what you are doing is making a table out of a table, where as I am asking you to pass the table.

in my example, you will get

param.level="1"

in your example, you will get

param.test.level="1"

that is why it is not working,

Please copy it right and it will work for you,

cheers,

?:)

I see the error now!

I guess i read up on tables indeed ;)

Thanks mate, it's working!

views:1472 update:2011/10/12 18:33:00
corona forums © 2003-2011