Yep, those are the sloppy bits. Thank you for the suggestions - I’ll get it cleaned up!
This kind of thing worked previously in other tests but it’s not working here. Any idea? I want to allow more dynamic map data loading.
function M.create_level(map_data_file, target_tilemap, map_tile_width, map_tile_height, tile_px_width, tile_px_height)
local script = ("/main/levels/level_1.lua")
local code = sys.load_resource(script)
local def = assert(loadstring(code))
--map_data_file = map_data_file or "/main/levels/level_1.lua"
--local def = assert(loadstring(sys.load_resource(map_data_file)))
Edit: Tested more things and still not sure why it’s not working… it could be “solved” by loading JSON but I’d still like to figure how to make this work
Edit2: Here is sample where it’s working for the JSON decoded file but not for the lua how I would expect. I’m going to continue refactoring with the JSON method and hope someone can give hint on how to get the lua method working. Not a deal breaker.
master.zip (542.9 KB)