Removing from the lua stack manually


I've got a problem:

I'm calling C from Lua with arguments then popping something onto the stack and calling a Lua function with the arg. But the previous arguments are still there so Lua gets confused and does nothing.

I looked around and lua has a lua_remove function to get rid of things from the stack but it seems we don't have access to that with the SDK. Is there another way of doing this or is it just not possible right now?

I tried to hide the stack manipulation stuff udner the C API because I think that's one of the most confusing and bug-inducing parts of Lua, but there are definitely places where it's hard to avoid. That said: have you tried this code in 1.13.1? I believe we fixed a bug there that sounds a lot like what you're reporting

  • Fixed stack error in playdate->lua->callFunction()

I made a test case calling Lua->C->Lua with arguments but couldn't reproduce your issue. If you're still running into that on 1.13.1 can you post some code that shows the problem?