It would be nice in the future to have a more elegant solution (than the garbage collection). Examples:
- to add a .free() function to the screen variable or
- to allow overwite of screen variable palettes/tile images/maps with the currently existing funtions
Thanks for testing and confirming the work-around! Actually, the current code was written with the "overwrite screen variable" in mind. Try this:
1) g_BGTopMap = Screen.LoadTileBG()
g_BGTopMap:LoadPalette( "./img/splash1.pal" )
g_BGTopMap:LoadTiles( "./img/splash1.raw", 256 )
g_BGTopMap:LoadMap( "./img/splash1.map", ( 256 / 8 ), ( 192 / 8 ) )
Screen.Initialize( SCREEN_TOP, g_BGTopMap )
2) When you are ready to change backgrounds, just do the following:
g_BGTopMap:LoadPalette( "./img/snowBG.pal" )
g_BGTopMap:LoadTiles( "./img/snowBG.raw", 256 )
g_BGTopMap:LoadMap( "./img/snowBG.map", ( 256 / 8 ), ( 192 / 8 ) )
See if that works better. DSLua will de-allocates the resources when you call the Load* functions the second time around.
Thanks,
Waruwaru