couple of helper methods
This commit is contained in:
parent
f47d36eb8b
commit
b4fe354c41
16
wrapper.go
16
wrapper.go
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user