func unpackArrayToLua(state State, a *P.Array) { L := state.L n := len(a.Elems) C.lua_createtable(L, C.int(n), 0) for i := 0; i < n; i++ { UnpackObjectToLua(state, a.Elems[i]) C.lua_rawseti(L, C.int(-2), C.int(i+1)) } }
func luaKeys(state State) int { L := state.L vmap := mustBeMap(state, 2) if vmap == nil { C.lua_pushnil(L) pushStringToLua(L, "Keys() only apply to `map'") return 2 } vkeys := vmap.MapKeys() C.lua_createtable(L, C.int(len(vkeys)), 0) for i := 0; i < len(vkeys); i++ { if !state.goToLuaValue(vkeys[i]) { continue } C.lua_rawseti(L, C.int(-2), C.int(i+1)) } return 1 }
// lua_rawseti func (L *State) RawSeti(index int, n int) { C.lua_rawseti(L.s, C.int(index), C.int(n)) }
// Does the equivalent of t[n] = 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. The assignment is raw; // that is, it does not invoke metamethods. func (this *State) Rawseti(index, n int) { C.lua_rawseti(this.luastate, C.int(index), C.int(n)) }
// Does the equivalent of t[n] = 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. The assignment is raw; // that is, it does not invoke metamethods. func (s *State) Rawseti(index, n int) { C.lua_rawseti(s.l, C.int(index), C.int(n)) }