本文整理匯總了Golang中C.lua_pushvalue函數的典型用法代碼示例。如果您正苦於以下問題:Golang lua_pushvalue函數的具體用法?Golang lua_pushvalue怎麽用?Golang lua_pushvalue使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lua_pushvalue函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: init
func (self *RefLua) init(state State, lobject int) {
self.VM = state.VM
C.lua_pushvalue(state.L, C.int(lobject))
refvalue := C.luaL_ref(state.L, C.LUA_REGISTRYINDEX)
self.Ref = int(refvalue)
runtime.SetFinalizer(self, func(r *RefLua) {
r.Release()
})
}
示例2: luaGetSubTable
func luaGetSubTable(L *C.lua_State, table C.int, key string) (bool, error) {
pushStringToLua(L, key)
C.lua_gettable(L, table)
ltype := C.lua_type(L, -1)
if ltype == C.LUA_TNIL {
C.lua_createtable(L, 0, 0)
// table[key] = {}
pushStringToLua(L, key)
C.lua_pushvalue(L, -2)
C.lua_settable(L, table)
}
ltype = C.lua_type(L, -1)
if ltype != C.LUA_TTABLE {
C.lua_settop(L, -2)
return false, fmt.Errorf("field `%v` exist, and it is not a table", key)
}
return true, nil
}
示例3: PushValue
// lua_pushvalue
func (L *State) PushValue(index int) {
C.lua_pushvalue(L.s, C.int(index))
}
示例4: Pushvalue
// Pushes a copy of the element at the given valid index onto the stack.
func (this *State) Pushvalue(index int) {
C.lua_pushvalue(this.luastate, C.int(index))
}
示例5: Pushvalue
// Pushes a copy of the element at the given valid index onto the stack.
func (s *State) Pushvalue(index int) {
C.lua_pushvalue(s.l, C.int(index))
}