MCPcopy Index your code
hub / github.com/Cyinx/einx / NewLuaStae

Function NewLuaStae

lua/lua_state.go:22–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 return this.lua
21}
22func NewLuaStae() *LuaRuntime {
23 vm := lua.NewState(lua.Options{
24 CallStackSize: 4096,
25 RegistrySize: 4096,
26 SkipOpenLibs: true,
27 IncludeGoStackTrace: true,
28 })
29
30 std_libs := map[string]lua.LGFunction{
31 lua.LoadLibName: lua.OpenPackage,
32 lua.BaseLibName: lua.OpenBase,
33 lua.TabLibName: lua.OpenTable,
34 lua.OsLibName: OpenOsRuntime,
35 lua.StringLibName: lua.OpenString,
36 lua.MathLibName: lua.OpenMath,
37 }
38
39 for name, lib := range std_libs {
40 vm.Push(vm.NewFunction(lib))
41 vm.Push(lua.LString(name))
42 vm.Call(1, 0)
43 }
44
45 vm.SetGlobal("print", vm.NewFunction(luaPrint))
46 vm.SetGlobal("lua_unmarshal", vm.NewFunction(luaUnMarshal))
47 vm.SetGlobal("lua_marshal", vm.NewFunction(luaMarshal))
48
49 runtime := &LuaRuntime{
50 lua: vm,
51 }
52 return runtime
53}
54
55func (this *LuaRuntime) DoFile(path string) {
56 if err := this.lua.DoFile(path); err != nil {

Callers

nothing calls this directly

Calls 1

PushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…