mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 01:32:33 +02:00
QOL & Security improvement
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
+16
-1
@@ -11,7 +11,22 @@ import (
|
||||
)
|
||||
|
||||
func newLuaState(mgr *Manager, p *Plugin) *lua.LState {
|
||||
L := lua.NewState()
|
||||
L := lua.NewState(lua.Options{SkipOpenLibs: true})
|
||||
for _, lib := range []struct {
|
||||
name string
|
||||
fn lua.LGFunction
|
||||
}{
|
||||
{lua.LoadLibName, lua.OpenPackage},
|
||||
{lua.BaseLibName, lua.OpenBase},
|
||||
{lua.TabLibName, lua.OpenTable},
|
||||
{lua.StringLibName, lua.OpenString},
|
||||
{lua.MathLibName, lua.OpenMath},
|
||||
{lua.CoroutineLibName, lua.OpenCoroutine},
|
||||
} {
|
||||
L.Push(L.NewFunction(lib.fn))
|
||||
L.Push(lua.LString(lib.name))
|
||||
L.Call(1, 0)
|
||||
}
|
||||
registerUtilities(L, mgr, p)
|
||||
return L
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user