summaryrefslogtreecommitdiff
path: root/src/ode/setup.c
diff options
context:
space:
mode:
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