summaryrefslogtreecommitdiff
path: root/demo/Enum.lua
diff options
context:
space:
mode:
Diffstat (limited to 'demo/Enum.lua')
-rw-r--r--demo/Enum.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/demo/Enum.lua b/demo/Enum.lua
new file mode 100644
index 0000000..d7fe469
--- /dev/null
+++ b/demo/Enum.lua
@@ -0,0 +1,18 @@
+local Enum = function (enumStrings)
+ local enumTable = {}
+ for _,str in pairs(enumStrings) do
+ enumTable[str] = str
+ end
+
+ local enum = {}
+ setmetatable(enum, { __index = enumTable,
+ __newindex = function(table, key, value)
+ error('Attempt to edit enum!')
+ end
+ }
+ )
+
+ return enum
+end
+
+return Enum