summaryrefslogtreecommitdiff
path: root/src/rawobject.nobj.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/rawobject.nobj.lua')
-rw-r--r--src/rawobject.nobj.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/rawobject.nobj.lua b/src/rawobject.nobj.lua
index 26b07ef..004303f 100644
--- a/src/rawobject.nobj.lua
+++ b/src/rawobject.nobj.lua
@@ -55,6 +55,12 @@ static void RawObject_from_git_rawobj(lua_State *L, RawObject *raw, git_rawobj *
}
}
+static void RawObject_close(lua_State *L, RawObject *raw) {
+ luaL_unref(L, LUA_REGISTRYINDEX, raw->ref);
+ raw->ref = LUA_REFNIL;
+ raw->git.data = NULL;
+}
+
]],
userdata_type = 'embed',
default = 'NULL',
@@ -81,11 +87,14 @@ static void RawObject_from_git_rawobj(lua_State *L, RawObject *raw, git_rawobj *
raw.ref = LUA_REFNIL;
]],
},
- destructor "close" {
+ destructor {
+ c_source [[
+ RawObject_close(L, ${this});
+]],
+ },
+ method "close" {
c_source [[
- luaL_unref(L, LUA_REGISTRYINDEX, ${this}->ref);
- ${this}->ref = LUA_REFNIL;
- ${this}->git.data = NULL;
+ RawObject_close(L, ${this});
]],
},
method "data" {