Stopping functions

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Stopping functions

Post by link »

In my quest to make me game, i have added a menu, and some levels. the problem lies with the menu still being active(i can see it in the background) when i load a level. I am currently using something like this

Code: Select all

if level==1 then
dofile("level1.lua")
elseif level==2 then
dofile("level2.lua")
...etc.
end
when i select my level, it loads the level fine but from a wallpaper error you can see my menu still going on in the background. my concern is that this will make my game slow down. what function should i use instead of "dofile"? or what function should i use to cease the menu from opperating?
Bob535
Posts: 56
Joined: Fri Nov 04, 2005 6:52 am

Post by Bob535 »

When you run another file, just use a break on the first file to terminate the process. I think it works, and that is what I do.
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Post by link »

I tried that but all it did was create the menu to be flashing in the background.
User avatar
JoshDB
Posts: 87
Joined: Wed Oct 05, 2005 3:54 am

Post by JoshDB »

If you call your menu from inside "level1.lua" etc. then just appropriate a variable like [menushow = true/false], then say

Code: Select all

if menushow == true then
dofile("menu.lua")
end
Post Reply