Can golang call lua?

Release: 2020-03-13 09:15:19
Original
3640 people have browsed it

Can golang call lua?

golang can call lua.

Golang uses golua to call lua scripts:

1: import

import "github.com/aarzilli/golua/lua"
Copy after login

2: Call several important functions of lua scripts

L := lua.NewState() //创建一个lua虚拟机 L.DoFile("./xxx") //设置要调用的lua文件 L.GetField(lua.LUA_GLOBALSINDEX,"xxx") //获取lua脚本的符号 L.Call(arg1,arg2) //调用函数 第一个参数标识参数的个数,第二个参数标识返回值的个数
Copy after login

For more golang knowledge, please pay attention to the PHP Chinese websitegolang tutorialcolumn.

The above is the detailed content of Can golang call lua?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!