diff --git a/bridge.lua b/bridge.lua index aec5f81f..922d4401 100644 --- a/bridge.lua +++ b/bridge.lua @@ -1577,17 +1577,15 @@ return function(_python, _bridged) if modname == "bridge" then return function() return env.kobold, env.koboldcore end end - for k, v in pairs(sandbox_require_builtins) do - if modname == k then - return env[k] - end - end if type(modname) == "number" then modname = tostring(modname) elseif type(modname) ~= "string" then error("bad argument #1 to 'require' (string expected, got "..type(modname)..")") return end + if sandbox_require_builtins[modname] then + return env[modname] + end local allowsearch = type(modname) == "string" and string.match(modname, "[^%w._-]") == nil and string.match(modname, "%.%.") == nil if allowsearch and package_loaded[env] == nil then package_loaded[env] = {}