Golang C.lua_objlen类(方法)实例源码

下面列出了Golang C.lua_objlen 类(方法)源码代码实例,从而了解它的用法。

作者:hxyx    项目:goinf   
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
}

作者:szl    项目:golu   
// lua_objlen
func (L *State) ObjLen(index int) uint {
	return uint(C.lua_objlen(L.s, C.int(index)))
}

作者:halturi    项目:luaji   
// 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)))
}


问题


面经


文章

微信
公众号

扫码关注公众号