示例#1
0
文件: pack.go 项目: hxyxj/goinfi
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))
	}
}
示例#2
0
文件: golang.go 项目: hxyxj/goinfi
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
}
示例#3
0
文件: lua.go 项目: szll/golua
// lua_rawseti
func (L *State) RawSeti(index int, n int) {
	C.lua_rawseti(L.s, C.int(index), C.int(n))
}
示例#4
0
文件: State.go 项目: rdlaitila/leaf
// 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))
}
示例#5
0
文件: state.go 项目: halturin/luajit
// 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))
}