From 529f3ba86e459fc205780227949ac2e0654ac565 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 22 Mar 2014 17:56:12 +1000 Subject: Actually check if we need to return Thing default, and return it. --- ClientHamr/GuiLua/skang.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index ec88dd6..327dc38 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -134,6 +134,7 @@ Thing = end, isValid = function (self) -- Check if this Thing is valid, return resulting error messages in errors. self.errors = {} + -- TODO - Should check for required, matching mask, matching type, etc. return true end, remove = function (self) -- Delete this Thing. @@ -153,7 +154,13 @@ Thing = local thing = things[key] -- First see if this is a Thing. - if thing and (key ~= thing.names[1]) then return table[thing.names[1] ] end + if thing then + local result = nil + if key ~= thing.names[1] then + result = table[thing.names[1] ] + end + return result or thing.default + end -- Then see if we can inherit it from Thing. thing = Thing[key] -- cgit v1.1