Merge pull request #4528 from XiShanYongYe-Chang/remove-redundant-os-preload

Remove redundant os preload in lua vm
This commit is contained in:
karmada-bot 2024-01-19 10:53:41 +08:00 committed by GitHub
commit 0e501b607a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 5 deletions

View File

@ -65,8 +65,6 @@ func (vm *VM) NewLuaState() (*lua.LState, error) {
if err != nil {
return nil, err
}
// preload our 'safe' version of the OS library. Allows the 'local os = require("os")' to work
l.PreloadModule(lua.OsLibName, lualifted.SafeOsLoader)
// preload kube library. Allows the 'local kube = require("kube")' to work
l.PreloadModule(KubeLibName, KubeLoader)
return l, err
@ -326,8 +324,6 @@ func NewWithContext(ctx context.Context) (*lua.LState, error) {
if err != nil {
return nil, err
}
// preload our 'safe' version of the OS library. Allows the 'local os = require("os")' to work
l.PreloadModule(lua.OsLibName, lualifted.SafeOsLoader)
// preload kube library. Allows the 'local kube = require("kube")' to work
l.PreloadModule(KubeLibName, KubeLoader)
if ctx != nil {

View File

@ -34,7 +34,7 @@ import (
// OpenSafeOs open safe os
func OpenSafeOs(L *lua.LState) int {
tabmod := L.RegisterModule(lua.TabLibName, osFuncs)
tabmod := L.RegisterModule(lua.OsLibName, osFuncs)
L.Push(tabmod)
return 1
}