LuaComp/src/directives/include.lua

15 lines
544 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
function directives.include(env, file)
2021-06-26 00:46:38 +10:00
local sr, err = stat.stat(file)
if not sr then return false, err end
2021-06-25 19:31:33 +10:00
--[[local f = io.open(file, "r")
2019-11-06 06:47:42 +11:00
local fast = mkast(f, file)
2020-03-19 05:08:15 +11:00
fast.file = file
2019-11-06 06:47:42 +11:00
local code = generate(fast)
2021-06-25 19:31:33 +10:00
env.code = env.code .. code .. "\n"]]
env.code = env.code .. luacomp.process_file(file, file) .. "\n"
2019-11-06 06:47:42 +11:00
return true
end