diff options
author | David Walter Seikel | 2014-03-22 17:56:12 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-03-22 17:56:12 +1000 |
commit | 529f3ba86e459fc205780227949ac2e0654ac565 (patch) | |
tree | 2674137510f45ece8150b3638efe58dff7f0589c | |
parent | Fix infinite lookup loop. (diff) | |
download | SledjHamr-529f3ba86e459fc205780227949ac2e0654ac565.zip SledjHamr-529f3ba86e459fc205780227949ac2e0654ac565.tar.gz SledjHamr-529f3ba86e459fc205780227949ac2e0654ac565.tar.bz2 SledjHamr-529f3ba86e459fc205780227949ac2e0654ac565.tar.xz |
Actually check if we need to return Thing default, and return it.
Diffstat (limited to '')
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 9 |
1 files changed, 8 insertions, 1 deletions
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 = | |||
134 | end, | 134 | end, |
135 | isValid = function (self) -- Check if this Thing is valid, return resulting error messages in errors. | 135 | isValid = function (self) -- Check if this Thing is valid, return resulting error messages in errors. |
136 | self.errors = {} | 136 | self.errors = {} |
137 | -- TODO - Should check for required, matching mask, matching type, etc. | ||
137 | return true | 138 | return true |
138 | end, | 139 | end, |
139 | remove = function (self) -- Delete this Thing. | 140 | remove = function (self) -- Delete this Thing. |
@@ -153,7 +154,13 @@ Thing = | |||
153 | local thing = things[key] | 154 | local thing = things[key] |
154 | 155 | ||
155 | -- First see if this is a Thing. | 156 | -- First see if this is a Thing. |
156 | if thing and (key ~= thing.names[1]) then return table[thing.names[1] ] end | 157 | if thing then |
158 | local result = nil | ||
159 | if key ~= thing.names[1] then | ||
160 | result = table[thing.names[1] ] | ||
161 | end | ||
162 | return result or thing.default | ||
163 | end | ||
157 | 164 | ||
158 | -- Then see if we can inherit it from Thing. | 165 | -- Then see if we can inherit it from Thing. |
159 | thing = Thing[key] | 166 | thing = Thing[key] |