summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/util.lua b/util.lua
index 3f1c159..5f4b700 100644
--- a/util.lua
+++ b/util.lua
@@ -1,6 +1,6 @@
--
-- Agario Checkers - Checkers-like game with inspiration from agar.io
--- Copyright (C) 2017 Delwink, LLC
+-- Copyright (C) 2017-2018 Delwink, LLC
--
-- Redistributions, modified or unmodified, in whole or in part, must retain
-- applicable copyright or other legal privilege notices, these conditions, and
@@ -36,6 +36,14 @@
-- OF OR OTHER DEALINGS IN THE WORK.
--
+function functionize(v)
+ if type(v) ~= 'function' then
+ return function(self) return v end
+ end
+
+ return v
+end
+
function string:startswith(pattern)
return self:sub(1, pattern:len()) == pattern
end