From 77d4fc9c4ac813f9711dc482cc2cf5ad2e792db1 Mon Sep 17 00:00:00 2001 From: grilledham Date: Fri, 6 Apr 2018 22:51:17 +0100 Subject: [PATCH] added global token --- utils/global_token.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 utils/global_token.lua diff --git a/utils/global_token.lua b/utils/global_token.lua new file mode 100644 index 00000000..a5168da4 --- /dev/null +++ b/utils/global_token.lua @@ -0,0 +1,20 @@ +local Token + +local tokens = {} + +local counter = 1 + +function Token.register(var) + local c = counter + + tokens[c] = var + counter = c + 1 + + return c +end + +function Token.get(token_id) + return tokens[token_id] +end + +return Token \ No newline at end of file