I've been getting really confused with this app I'm building. I'm trying to pass a parameter to a different scene. When I try to access passed in value, I can't use it. I keep getting the error "
bad argument #1 to 'find' (string expected, got table)"
When I try to convert the value from a table to string, I get "bad argument #1 to 'concat' (table expected, got string)". I'm pretty new to Lua, so any help would be very appreciated. Here is some relevant code.
Scene1:
Scene2:
The results of the four print commands are as follows:
false
false
string
false
bad argument #1 to 'find' (string expected, got table)"
When I try to convert the value from a table to string, I get "bad argument #1 to 'concat' (table expected, got string)". I'm pretty new to Lua, so any help would be very appreciated. Here is some relevant code.
Scene1:
Lua:
local function gotoOpt()
scene:removeEventListener( "create", scene )
local customParams = {
var1 = "scene3"
}
composer.gotoScene( "scene2", { effect="fade", time=1, params=customParams })
end
Scene2:
Lua:
function scene:create( event )
local sceneGroup = self.view
print(event.params.var1 == string)
print(event.params.var1 == table)
print(type(event.params.var1))
print(type(event.params.var1) == string)
end
The results of the four print commands are as follows:
false
false
string
false