代码拉取完成,页面将自动刷新
package conn
import (
"github.com/guonaihong/glua/lib/cmdparse"
"github.com/guonaihong/glua/lib/json"
"github.com/guonaihong/glua/lib/log"
"github.com/guonaihong/glua/lib/socket"
"github.com/guonaihong/glua/lib/strings"
"github.com/guonaihong/glua/lib/time"
"github.com/guonaihong/glua/lib/uuid"
"github.com/yuin/gopher-lua"
)
type LuaEngine struct {
L *lua.LState
args string
}
func (l *LuaEngine) getCmdArgs(L *lua.LState) int {
l.L.Push(lua.LString(l.args)) /* push result */
return 1
}
func NewLuaEngine(kargs string) *LuaEngine {
L := lua.NewState()
engine := &LuaEngine{L: L, args: kargs}
L.PreloadModule("socket", socket.Loader)
L.PreloadModule("flag", cmdparse.Loader)
L.PreloadModule("time", time.Loader)
L.PreloadModule("strings", strings.Loader)
L.PreloadModule("log", log.Loader)
L.PreloadModule("uuid", uuid.Loader)
L.PreloadModule("json", json.Loader)
L.SetGlobal("get_cmd_args", L.NewFunction(engine.getCmdArgs))
//socket.RegisterSocketType(L)
return engine
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。