It's far, far less elegant than the Playbox2d implementation, but I did cobble together a set of proof-of-concept Lua bindings for Chipmunk2D a while ago before life really got in the way, largely by cribbing from work done by Dustin and maximile. Box2d lite is beautifully simple, but it was a little too simple for what I wanted. Chipmunk is much more extensive (for better or worse), which for my purposes meant it could do efficient circles and arbitrary convex polygons.
I haven't had the chance to pick it back up owing to a combination of life events and my tendencies as a, uh, generalist, but I think this demo could be a useful start, and shows a simple way to implement Playdate sprites that are backed by Chipmunk bodies. I found it pretty handy as a scratchpad for performance expectations and mockups of what might be fun physics toys, and I kind of like my editor UI.
It doesn't have Lua bindings for everything (or even most of the things) in Chipmunk, but if you look at luaglue.c you can see a pretty straightforward way to grind out whatever extra Chipmunk methods you need to expose.
Major limitations:
-
Builds fine with make on Mac, but it doesn't have a functioning Windows CMake build. I didn't have fun engaging with the CMake docs or the Windows build toolchain, so I stopped. I assume it's easy if you understand CMake; I just didn't want to understand CMake. The linked forum post does have a built pdx file to play around with.
-
Collision detection/callbacks aren't yet implemented in the Lua wrappers, so while collisions work on their own, you can't query them to, say, trigger sound effects or scoring events, or implement a meaningful sort of "kick"/"jump" action.
Chipmunk handles collision event hooks via callbacks; it'd be pretty cool to be able to register Lua callbacks that get triggered by the Chipmunk runtime with all the relevant data converted, but I'm not smart/energetic enough to really know if that's feasible or desirable. My plan was just to have the C wrapper maintain queriable lists of current collisions based on cpCollisionType, so your Lua code could just ask for those lists and respond to any changes as appropriate.