Commit 7de2ee6c authored by Renato Figueiro Maia's avatar Renato Figueiro Maia

[OPENBUS-2723] Permitir utilizar funções padrão de Lua no arquivo de configuração do 'busservices'

- Ajuste para permitir carregar no arquivo de configuração pacotes precarregados no binário.

git-svn-id: ae0415b3-e90b-0410-900d-d0be9363c56b
parent 85218417
......@@ -22,7 +22,7 @@ local string = require "string"
local module = {}
function module.create()
function module.create(...)
local preloaded = {}
local packcfg = {
preload = preloaded,
......@@ -155,24 +155,32 @@ function module.create()
env[name] = module
local forbiden = {...}
function env.require(name)
local module = allowed[name]
if module == nil then
local isforbiden
for _, pattern in ipairs(forbiden) do
if match(name, pattern) then
isforbiden = true
if isforbiden then
error("no permission to load module '""'")
local loader = preloaded[name]
if loader ~= nil then
module = loader(name)
if module == nil then
module = true
elseif preload[name] == nil and loaded[name] == nil then
local path, cpath = package.path, package.cpath
package.path, package.cpath = packcfg.path, packcfg.cpath
local ok, result = xpcall(require, traceback, name)
package.path, package.cpath = path, cpath
if not ok then error(result) end
module = result
error("no permission to load module '""'")
allowed[name] = module
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment