// 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) }
// 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) }
// 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) }
func (L *State) SetGlobal(name string) { C.lua_setfield(L.s, C.int(LUA_GLOBALSINDEX), C.CString(name)) }
func (L *State) SetField(index int, k string) { C.lua_setfield(L.s, C.int(index), C.CString(k)) }
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) }