Is it possible to parse arbitrary nested tables passed from Lua to C? I'm relatively new to Lua, but it looks like Playdate doesn't expose any of the stock Lua functions for working with lua_State, so my only choice is to use the playdate->lua functions, but those don't seem to allow for parsing tables arbitrarily.
The context here is that I'm porting the poorly performing core logic of my game from Lua to C, and when I was all in Lua, I defined a level like this:
LEVELS.intro1 = {
name = "Basics 1", next = "intro2",
emitter = { x = 20, y = 120, deg = 90, speed = 200, rate = 0.05, },
target = { x = 300, y = 160, deg = 270, },
barriers = {
{ x = 20, y = 30, w = 360, h = 10 },
{ x = 20, y = 200, w = 360, h = 10 },
...
}
As a workaround, I've started creating Lua functions in C, like setName
, setNext
, initEmitter
, initTarget
, and addBarrier
. Should I just continue down that road? Or pursue some other option?