LuaComp/src/directives/loadmod.lua

19 lines
644 B
Lua
Raw Normal View History

2021-06-26 02:06:38 +10:00
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
2019-11-06 06:47:42 +11:00
local warned = false
function directives.loadmod(env, mod)
if not warned then
2021-06-26 02:35:25 +10:00
lc_warning("@[{_GENERATOR.fname}]", "loadmod is depreciated and unsafe. The API differs from luapreproc. Use the include paths!")
2019-11-06 06:47:42 +11:00
warned = true
end
2021-06-26 02:35:25 +10:00
--if (not os.execute("stat "..file..">/dev/null")) then
local sr, se = stat.stat(file)
if not sr then
return false, se
2019-11-06 06:47:42 +11:00
end
local modname, func = dofile(mod)
directives[modname] = func
return true
end