From 0019348d92ec0ac4151102dea07a8b61407391af Mon Sep 17 00:00:00 2001 From: ibm2431 Date: Sun, 23 Feb 2020 07:05:57 -0800 Subject: [PATCH] Add set constructor --- scripts/globals/common.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/globals/common.lua b/scripts/globals/common.lua index 4f5dd6c08f3..49144b11187 100644 --- a/scripts/globals/common.lua +++ b/scripts/globals/common.lua @@ -32,6 +32,18 @@ function printf(s,...) print(s:format(...)) end +----------------------------------- +-- set() +-- Returns a set that can be checked against +----------------------------------- +function set(list) + local set = {} + for _, item in pairs(list) do + set[item] = true + end + return set +end + ----------------------------------- -- getMidnight -- Returns midnight for the current day in epoch format