From f9cbe3cc5f1867f128015364ce41cab909f93a84 Mon Sep 17 00:00:00 2001 From: David McMackins II Date: Sat, 19 May 2018 08:16:48 -0500 Subject: Add functionize --- util.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3