本文整理匯總了Golang中C.lua_objlen函數的典型用法代碼示例。如果您正苦於以下問題:Golang lua_objlen函數的具體用法?Golang lua_objlen怎麽用?Golang lua_objlen使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lua_objlen函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetnWithError
func (tbl *Table) GetnWithError() (int, error) {
if tbl.Ref == 0 {
return 0, fmt.Errorf("cannot get lenght a released lua table")
}
L := tbl.VM.globalL
state := State{tbl.VM, L}
bottom := int(C.lua_gettop(L))
defer C.lua_settop(L, C.int(bottom))
tbl.PushValue(state)
n := int(C.lua_objlen(L, C.int(-1)))
return n, nil
}
示例2: ObjLen
// lua_objlen
func (L *State) ObjLen(index int) uint {
return uint(C.lua_objlen(L.s, C.int(index)))
}
示例3: Objlen
// Returns the "length" of the value at the given valid index: for
// strings, this is the string length; for tables, this is the result of
// the length operator ('#'); for userdata, this is the size of the block
// of memory allocated for the userdata; for other values, it is 0.
func (s *State) Objlen(index int) int {
return int(C.lua_objlen(s.l, C.int(index)))
}