1
0

couple of helper methods

This commit is contained in:
Sky Johnson 2025-07-14 14:03:37 -05:00
parent f47d36eb8b
commit b4fe354c41

View File

@ -725,3 +725,19 @@ func (s *State) pushMapSlice(arr []map[string]any) error {
}
return nil
}
// PushLightUserData pushes a light userdata value
func (s *State) PushLightUserData(ptr any) {
C.lua_pushlightuserdata(s.L, unsafe.Pointer(&ptr))
}
// Helper method for getting table length used internally
func (s *State) getTableLength(index int) int {
length := 0
s.PushNil()
for s.Next(index - 1) {
length++
s.Pop(1)
}
return length
}