Chasing run errors

Hi,

I am presently chasing a run time error that I know why its happening but don’t know how to fix. My question is this: There is a function in main called “showscreen”, main calls several other modules and one of these modules wants to call that function “showscreen”, how do I do this?

[code]
Runtime error
…ons/CoronaSDK/SampleCode/Interface/TabBar/iphone.lua:119: attempt to call global ‘showScreen’ (a nil value)
stack traceback:
[C]: in function ‘showScreen’
…ons/CoronaSDK/SampleCode/Interface/TabBar/iphone.lua:119: in function ‘_onRelease’
?: in function <?:887>
?: in function <?:215>

[import]uid: 95689 topic_id: 16801 reply_id: 316801[/import]

Post up some code please :slight_smile: [import]uid: 84637 topic_id: 16801 reply_id: 63133[/import]

In main try including the modules *after* the showscreen function. [import]uid: 9422 topic_id: 16801 reply_id: 63160[/import]

@XenonBL
All modules are called after “showscreen”

@Danny
Actually, its in “iphone.lau” which is called by “per.data.lua” and its a handler to handle an “all done” button and get back to main. Here is a small block diagram:

can’t paste pic

[code]

– Handler for “all done” button

local on_alldone_ButtonRelease = function( event )
local function loadScreen(newScreen)
if currentScreen then
currentScreen:cleanUp()
end
currentScreen = require(newScreen).new()
tabView:insert(currentScreen)

return true
end
showScreen()
end

[text]
Here is the error again, actually there are two errors:

Copyright © 2009-2011 A n s c a , I n c .
Version: 2.0.0
Build: 2011.591
The file sandbox for this project is located at the following folder:
(/Users/alexdiaz/Library/Application Support/Corona Simulator/TabBar-70E2E927A807AF4D44B35FC7376C0307)
set up all done button
Runtime error
…ns/CoronaSDK/SampleCode/Interface/TabBar/screen3.lua:26: attempt to index a boolean value
stack traceback:
[C]: ?
…ns/CoronaSDK/SampleCode/Interface/TabBar/screen3.lua:26: in main chunk
[C]: in function ‘require’
…tions/CoronaSDK/SampleCode/Interface/TabBar/main.lua:21: in function ‘loadScreen’
…tions/CoronaSDK/SampleCode/Interface/TabBar/main.lua:37: in function ‘onRelease’
…cations/CoronaSDK/SampleCode/Interface/TabBar/ui.lua:90: in function <…cations>
?: in function <?:215>
You pressed button #2
You pressed button #3
You pressed and released button #1
You pressed and released button #2
Runtime error
…ons/CoronaSDK/SampleCode/Interface/TabBar/iphone.lua:119: attempt to call global ‘showScreen’ (a nil value)
stack traceback:
[C]: in function ‘showScreen’
…ons/CoronaSDK/SampleCode/Interface/TabBar/iphone.lua:119: in function ‘_onRelease’
?: in function <?:887>
?: in function <?:215>


[import]uid: 95689 topic_id: 16801 reply_id: 63214[/import] </…cations>

Danny,

I am still working on combining two of the example code modules on “getting Started”. The “Tabar” and “Widget” programs. [import]uid: 95689 topic_id: 16801 reply_id: 63400[/import]