當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.lua_close函數代碼示例

本文整理匯總了Golang中C.lua_close函數的典型用法代碼示例。如果您正苦於以下問題:Golang lua_close函數的具體用法?Golang lua_close怎麽用?Golang lua_close使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了lua_close函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: main

func main() {

	L := C.luaL_newstate()
	defer C.lua_close(L)

	C.luaL_openlibs(L) /* Load Lua libraries */
	C.luaopen_cmsgpack(L)

	sumS := C.CString(sum)
	defer C.free(unsafe.Pointer(sumS))

	C.luaL_loadstring(L, sumS)

	msg, _ := msgpack.Marshal([]int{1, 2, 3, 4, 5, 6})
	C.lua_pushstring(L, cptr(msg))

	dstr := C.CString("mpdata")
	defer C.free(unsafe.Pointer(dstr))
	C.luaSetglobal(L, dstr)

	C.luaExecute(L)

	sum := C.lua_tonumber(L, -1)

	fmt.Println(sum) // Output: 21
}
開發者ID:KanwarGill,項目名稱:trifles,代碼行數:26,代碼來源:main.go

示例2: Destroy

// Closes the lua context.
func (e *ExecutionEngine) Destroy() {
	if e.state != nil {
		C.lua_close(e.state)
		e.state = nil
	}
	if e.iterator != nil {
		e.SetIterator(nil)
	}
}
開發者ID:ngocthanhit,項目名稱:sky,代碼行數:10,代碼來源:execution_engine.go

示例3: Close

// lua_close
func (L *State) Close() {
	C.lua_close(L.s)
}
開發者ID:szll,項目名稱:golua,代碼行數:4,代碼來源:lua.go

示例4: Close

// Destroys all objects in the given Lua state (calling the corresponding
// garbage-collection metamethods, if any) and frees all dynamic memory
// used by this state. On several platforms, you may not need to call
// this function, because all resources are naturally released when the
// host program ends. On the other hand, long-running programs, such as
// a daemon or a web server, might need to release states as soon as they
// are not needed, to avoid growing too large.
func (this *State) Close() {
	C.lua_close(this.luastate)
}
開發者ID:rdlaitila,項目名稱:leaf,代碼行數:10,代碼來源:State.go

示例5: Close

// lua_close
func (L *State) Close() {
	C.lua_close(L.s)
	unregisterGoState(L)
}
開發者ID:aarzilli,項目名稱:golua,代碼行數:5,代碼來源:lua.go

示例6: Close

// Destroys all objects in the given Lua state (calling the corresponding
// garbage-collection metamethods, if any) and frees all dynamic memory
// used by this state. On several platforms, you may not need to call
// this function, because all resources are naturally released when the
// host program ends. On the other hand, long-running programs, such as
// a daemon or a web server, might need to release states as soon as they
// are not needed, to avoid growing too large.
func (s *State) Close() {
	C.lua_close(s.l)
}
開發者ID:halturin,項目名稱:luajit,代碼行數:10,代碼來源:state.go

示例7: Close

// Close close the lua vm
func (l *Lua) Close() {
	C.lua_close(l.State)
}
開發者ID:reusee,項目名稱:lua,代碼行數:4,代碼來源:lua.go

示例8: free

// 釋放lua_stat
func (L *State) free() {
	log.Printf("Free %v.\n", *L)
	C.lua_close(L.s)
}
開發者ID:gooops,項目名稱:glua,代碼行數:5,代碼來源:glua.go

示例9: Close

func (vm *VM) Close() {
	C.lua_close(vm.globalL)
	vm.globalL = nil
}
開發者ID:hxyxj,項目名稱:goinfi,代碼行數:4,代碼來源:lua.go

示例10: Close

func Close(s *State) {
	C.lua_close((*C.lua_State)(s))
}
開發者ID:vron,項目名稱:lua,代碼行數:3,代碼來源:core.go


注:本文中的C.lua_close函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。