当前位置: 首页>>代码示例>>Golang>>正文


Golang C.lua_objlen函数代码示例

本文整理汇总了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
}
开发者ID:hxyxj,项目名称:goinfi,代码行数:14,代码来源:lobject.go

示例2: ObjLen

// lua_objlen
func (L *State) ObjLen(index int) uint {
	return uint(C.lua_objlen(L.s, C.int(index)))
}
开发者ID:szll,项目名称:golua,代码行数:4,代码来源:lua.go

示例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)))
}
开发者ID:halturin,项目名称:luajit,代码行数:7,代码来源:state.go


注:本文中的C.lua_objlen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。