summaryrefslogtreecommitdiff
path: root/src/ode/setup.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-03-25 14:31:17 -0500
committersanine <sanine.not@pm.me>2023-03-25 14:31:17 -0500
commit50faaf10b296ebe3ca9af1cdf18f2b557b319be9 (patch)
tree6aa87e72fdaad871f811c70fa0828d32b79d4d75 /src/ode/setup.c
parentd4786851ffa0265f534ce66f337be2c15f2358a2 (diff)
add the ability to store data in geoms
Diffstat (limited to 'src/ode/setup.c')
-rw-r--r--src/ode/setup.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ode/setup.c b/src/ode/setup.c
index 2b5b1e3..3655b1e 100644
--- a/src/ode/setup.c
+++ b/src/ode/setup.c
@@ -14,10 +14,23 @@ ODE_METATABLES
#undef X
+int generic_eq(lua_State *L)
+{
+ void **a = lua_touserdata(L, 1);
+ void **b = lua_touserdata(L, 2);
+ lua_pushboolean(L, *a == *b);
+ return 1;
+}
+
+
void setup_ode(lua_State *L, int honey_tbl)
{
/* setup metatables */
- #define X(name, mt) luaL_newmetatable(L, mt); lua_pop(L, 1);
+ #define X(name, mt) \
+ luaL_newmetatable(L, mt); \
+ lua_pushcfunction(L, generic_eq); \
+ lua_setfield(L, -2, "__eq"); \
+ lua_pop(L, 1);
ODE_METATABLES
#undef X