tempmc/express.lua

25 lines
418 B
Lua
Raw Normal View History

2024-04-18 02:48:28 +02:00
-- Express configuration more sussunctly
local exp = {}
local types = {
download = {},
immediate = {},
command = {},
}
for name, _ in pairs(types) do
exp[name] = function(v)
return {v, [types[name]] = true}
end
exp["is_" .. name] = function(tbl)
return tbl[types[name]]
end
end
-- Produce a string contains alfanum and underscore
exp.safe = function(s)
return s:gsub("[^A-Za-z0-9]","-")
end
return exp