diff options
author | sanine-a <sanine.not@pm.me> | 2020-12-05 18:37:44 -0600 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-12-05 18:37:44 -0600 |
commit | ba9a7162b72e6b20466de7dd115719777315b5c2 (patch) | |
tree | 80ecd412817ca85adcb0ec944ab4a28be7b4737c /src/primitives.c | |
parent | 09a96abe4d6933eb473b0dd8a7027cc0cb04ac63 (diff) |
switch meshes to use metamathods
Diffstat (limited to 'src/primitives.c')
-rw-r--r-- | src/primitives.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/primitives.c b/src/primitives.c index ee68f6a..d858cc6 100644 --- a/src/primitives.c +++ b/src/primitives.c @@ -8,6 +8,8 @@ static int honey_mesh_lua_plane(lua_State* L) HONEY_NUMBER, &height); honey_mesh* mesh = lua_newuserdata(L, sizeof(honey_mesh)); + lua_rawgeti(L, LUA_REGISTRYINDEX, honey_mesh_mt_ref); + lua_setmetatable(L, -2); if (honey_mesh_new_textured_plane(mesh, width, height) != HONEY_OK) { lua_pushstring(L, "error encountered while building plane"); lua_error(L); @@ -24,6 +26,8 @@ static int honey_mesh_lua_cube(lua_State* L) HONEY_NUMBER, &depth); honey_mesh* mesh = lua_newuserdata(L, sizeof(honey_mesh)); + lua_rawgeti(L, LUA_REGISTRYINDEX, honey_mesh_mt_ref); + lua_setmetatable(L, -2); if (honey_mesh_new_textured_cube(mesh, width, height, depth) != HONEY_OK) { lua_pushstring(L, "error encountered while building plane"); lua_error(L); |