io.open() bug?

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

Moderators: Shine, Insert_witty_name

Post Reply
cgruber
Posts: 36
Joined: Tue Sep 06, 2005 6:38 am

io.open() bug?

Post by cgruber »

Code: Select all

function LoadLevel()

num_moves=0
levelnum = tostring(level)
map=string.format("%s%s", "./levels/", levelnum)
map=string.format("%s%s", map, ".lua")
if(io.open(map, r)==nil) then --open the file first to make sure it's there
   level=1 --wrap back to start
   gamefield=nil
   screen.waitVblankStart(60)  --short delay
   LoadLevel(1) --call yourself to load first level since we ran out.
   io.close()
else  -- yep it's there better close it
   io.close()
   gamefield=nil
   if(level~=1) then
   screen.waitVblankStart(60) --short delay
   end
   dofile(map)
   mappos=StartupPosition()
   return 1
end

end
This runs perfect everytime in Luaplayer for Windows. In luaplayer for PSP it runs perfect until the 10th time it is called and then dofile() no longer works.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

deja vu

didn't we had a really similar question yesterday?

try shineshighscore script :)
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Post Reply