feat: complete lua.h bindings ref system

This commit is contained in:
Erica Marigold 2024-07-19 20:45:30 +05:30
parent f8b1807e91
commit ba0fb22db0
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -660,5 +660,24 @@ func GetAllocF(L *LuaState, ud *unsafe.Pointer) LuaAlloc {
return *(*LuaAlloc)(unsafe.Pointer(C.lua_getallocf(L, ud))) return *(*LuaAlloc)(unsafe.Pointer(C.lua_getallocf(L, ud)))
} }
//
// ==========================
// Reference System
// ==========================
//
const (
LUA_NOREF = iota - 1
LUA_REFNIL
)
func Ref(L *LuaState, idx int32) int32 {
return int32(C.lua_ref(L, C.int(idx)))
}
func Unref(L *LuaState, ref int32) {
C.lua_unref(L, C.int(ref))
}
// TODO: Free udtor's after func // TODO: Free udtor's after func
// TODO: Rest of it // TODO: Rest of it