PDA

View Full Version : image limit in lua?



Anonymous D
July 9th, 2007, 01:24
i have a game i have written in lua. i load images at the start of each script , i have one for the game, menu and scores screens. each one loads 7-8 images aprt from scores.

my question is is there a limit to images loaded ? and if so is there a way to clear the memory, as i keep getting errors and the only possible reason seems to be im loading to many images in each script or cumulativley over the 3 .

edit:it works fine on the pc lua player but returns errors on the psp

Nicko01
July 9th, 2007, 04:56
yes, that would be why.
i recommend learning C instead. It isn't very much harder, and it is easy to port lua to C.
if you want to learn, go to www.psp-programming.com

dangee
July 9th, 2007, 07:42
no real limit on no. of images in lua,but
sounds like RAM overflow. At the end of
each script, undefine any images no longer
needed (eg level1Background = nil) and the
garbage collector should free up memory for you
automatically

*EDIT* making images local to the script
would have the same effect

Anonymous D
July 9th, 2007, 12:51
thankjs dangee that worked a treat

dangee
July 9th, 2007, 13:07
pleasure, btw theres loads of good lua stuff at evilmana (http://www.evilmana.com)

Anonymous D
July 9th, 2007, 14:53
lol im actually using that site anyway. one more question. i have a lua game id like to release here how do i do that? its not a standalone, just a folder to go in apps and works with lua player 0.16 best, o.20 returns a lot of random errors for no reason.

Safari Al
July 9th, 2007, 15:03
Just release it in the develoment forum

-Xandu-
July 9th, 2007, 15:12
You can post it in the Submit News forum.

If you're talking about how to boot it without having to play it from Lowser, here's how:
1- Open up the System\system.lua
2- Replace
System.currentDirectory("Applications")
appsDir = System.currentDirectory()

System.currentDirectory("Lowser")
dofile("index.lua")

with

dofile("script.lua") <---- Your index script file.
It should autoplay without having to play it from Lowser ;).

Anonymous D
July 9th, 2007, 15:14
thanks -Xandu- will do that

parkermauney
July 9th, 2007, 17:48
When doing that you can get rid of the "Lowser" folder.

dangee
July 9th, 2007, 20:18
..& while your at it,
move script.lua to /PSP/GAME/LuaPlayer/
(where the eboot is), and remove all the other subfolders and their files..

Anonymous D
July 9th, 2007, 20:34
(adding to this one i dont want to make a newe thread unecicarily) does anyone know how to deal with stack dumps? i have a script which on reading has no errors in the lua code but when i run it it produces luaplayer.exe.stackdump with some random numbers. can i fix this or do i need to re do the script somehow?

yaustar
July 9th, 2007, 20:36
(adding to this one i dont want to make a newe thread unecicarily) does anyone know how to deal with stack dumps? i have a script which on reading has no errors in the lua code but when i run it it produces luaplayer.exe.stackdump with some random numbers. can i fix this or do i need to re do the script somehow?

Usually it means you have blown the stack memory. E.g. Loading too many images, infinite loops loading resources etc.

Anonymous D
July 9th, 2007, 21:08
tbh i dont think i have, at least i dont think so. any chance someone could look over my code for me? any takers tell me and ill upload it somewhere and put a link. it would help so much

edit: this is for a side scrolling shooter im trying to make, not my console grab game

edit: here is my script with lua player and materials, plz have a look and see what ive done wrong im completely stumped
http://www.mediafire.com/?7i9nm6czznn

dangee
July 9th, 2007, 23:09
stack overflow can be a pig&a1/2 to fix! Id like to try n help, but stuck at the moment
on a PiKey problem.
if NE1 can help out , itd free up some techtime for ur debug

-Xandu-
July 9th, 2007, 23:17
The stack error is something with your images, I tried the images from your Console Grab game and it worked fine ;).

Anonymous D
July 9th, 2007, 23:19
thanks xandu ill try swapping them out or re doing them.

you were right xandu thanks a lot ill just have to redo the gfx for it, i needed to anyway tbh lol

edit: working fine now got the ship (a psp atm) firing 4 bullets (ds's atm), next up coding in 4 enemies and collision tests for enemies vs bullets and player vs bullets......