1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00
RedMew/utils/test/include.lua

15 lines
357 B
Lua
Raw Normal View History

local require = require
local pcall = pcall
2020-10-04 12:44:50 +02:00
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)
2020-10-04 12:44:50 +02:00
if not s and not file_is_missing(e) then
error(e, 2)
end
end