So what does that mean? It's a terrible thing when you can't remember how your own code works, To start, let's look at the Resource/Interface folder. In there, there is a file called GameMenu.xml that defines the initial menu screen. The first line in that file says
<Screen ScreenName="game_menu" ScriptFile="GameMenu.lua">
Also of interest in that file:
<TextButton Name = "Profile"
Image = "blank"
XPos = "600"
YPos = "200"
Width = "150"
Height = "38"
Transparency = "true"
Scale = "true"
Hidden = "false"
Handler = "new_button"
>
Together that tells us that a function called game_menu.new_button will get called when the Profile (Profile!?!) button is clicked. Having the button named "Profile" is a cut-and-paste error. Sadly, fixing it doesn't help. Anyway: When the *ahem* "New" button is clicked, we exepct game_menu.new_button to be called, which should be defined in GameMenu.lua.
We fined GameMenu.lua. in Resources/Scripts:
log("game menu handler script: init")
game_menu = {}
function game_menu.refresh()
log("refresh called from script")
return true
end
function game_menu.process(init_flag)
log("process called from script")
return true
end
function game_menu.new_button()
log("new button clicked")
--
-- pop the menu screen
--
pop_window()
--
-- show the intro screen
--
--show("Cloning")
show("intro")
--
-- show more than one and they stack, last in first displayed
-- if you want to pass arguments to a call, pass them as a table
--
Game.chapter = "Waking Up Is Hard To Do"
show("chapter")
return true
end
return 1
This was one of the earlier Lua handlers I wrote and it shows. It doesn't use Lua's module mechanism for instance. It does define the needed function so that's ok. But the only reference to a "game" namespace is the "game.chapter" reference. And I'm fairly certain that the error message in question is one of mine, not one from Lua. So back to square one. Time to look at the C++ source.
No comments:
Post a Comment