1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/utils/test/include.lua
2020-10-04 11:44:50 +01:00

15 lines
357 B
Lua

local require = require
local pcall = pcall
local find = string.find
local function file_is_missing(message)
return find(message, 'no such file') or find(message, 'File was removed to decrease save file size')
end
return function(name)
local s, e = pcall(require, name)
if not s and not file_is_missing(e) then
error(e, 2)
end
end