Thanks! My main purpose was to have everything programmable so i wouldn’t have to add components by hand for every level.
I ended up using Tiled to export the data to a lua module and had to load it dynamically.
Here’s how I did it if any one looks for this in the future:
local tileMap = "Level#tm_level"
local path = '/main/level/levels/' .. level .. '.lua'
local code_str = sys.load_resource(path)
local lua_func = assert(loadstring(code_str))
local levelData = lua_func()
reference for this solution:
dynamic load lua module