本文整理匯總了Golang中C.lua_setfield函數的典型用法代碼示例。如果您正苦於以下問題:Golang lua_setfield函數的具體用法?Golang lua_setfield怎麽用?Golang lua_setfield使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了lua_setfield函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SetGlobal
// lua_setglobal
func (L *State) SetGlobal(name string) {
Cname := C.CString(name)
defer C.free(unsafe.Pointer(Cname))
C.lua_setfield(L.s, C.int(LUA_GLOBALSINDEX), Cname)
}
示例2: SetField
// lua_setfield
func (L *State) SetField(index int, k string) {
Ck := C.CString(k)
defer C.free(unsafe.Pointer(Ck))
C.lua_setfield(L.s, C.int(index), Ck)
}
示例3: Setfield
// Does the equivalent to t[k] = v, where t is the value at the given valid
// index and v is the value at the top of the stack.
//
// This function pops the value from the stack. As in Lua, this function
// may trigger a metamethod for the "newindex" event
func (this *State) Setfield(index int, k string) {
ck := C.CString(k)
defer C.free(unsafe.Pointer(ck))
C.lua_setfield(this.luastate, C.int(index), ck)
}
示例4: SetGlobal
func (L *State) SetGlobal(name string) {
C.lua_setfield(L.s, C.int(LUA_GLOBALSINDEX), C.CString(name))
}
示例5: SetField
func (L *State) SetField(index int, k string) {
C.lua_setfield(L.s, C.int(index), C.CString(k))
}
示例6: Setglobal
func Setglobal(s *State, name string) {
// Defined as a macro
cs := C.CString(name)
defer C.free(unsafe.Pointer(cs))
C.lua_setfield((*C.lua_State)(s), GLOBALSINDEX, cs)
}