Home > Backend Development > Golang > Can golang call lua?

Can golang call lua?

Release: 2020-03-13 09:15:19
Original
3857 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 tutorial column.

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:
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 Issues
How to choose golang web mvc framework
From 1970-01-01 08:00:00
0
0
0
Is it necessary to use nginx when using golang?
From 1970-01-01 08:00:00
0
0
0
golang - vim plug-in to write go
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template