From c13ada054617f6ebceffc80dfea61cd820c216a3 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 22 Mar 2014 18:01:23 +1000 Subject: Test and fix setting nil on a Thing with a default. --- ClientHamr/GuiLua/skang.lua | 2 +- ClientHamr/GuiLua/test.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 327dc38..c0c63dc 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -184,7 +184,7 @@ Thing = print(thing.module._NAME .. '.' .. name .. '(' .. types .. ') -> ' .. thing.help) else thing:isValid() - print(thing.types[1] .. ' ' .. thing.module._NAME .. '.' .. name .. ' = ' .. value .. ' -> ' .. thing.help) + print(thing.types[1] .. ' ' .. thing.module._NAME .. '.' .. name .. ' = ' .. (value or 'nil') .. ' -> ' .. thing.help) -- TODO - Go through it's linked things and set them to. end rawset(table, name, value) diff --git a/ClientHamr/GuiLua/test.lua b/ClientHamr/GuiLua/test.lua index 6c48ca6..c1aeb7c 100644 --- a/ClientHamr/GuiLua/test.lua +++ b/ClientHamr/GuiLua/test.lua @@ -52,3 +52,9 @@ test.ffunc('one', 2) --skang.things.ffunc('seven', 'aight') test.f = 42 print('f is now ' .. test.fooble .. ' ' .. test.f .. ' ' .. skang.things.f.help .. ' ' .. skang.things.fooble.help) +test.f = nil +print('f is now ' .. test.fooble .. ' ' .. test.f .. ' ' .. skang.things.f.help .. ' ' .. skang.things.fooble.help) +test.fooble = 42 +print('f is now ' .. test.fooble .. ' ' .. test.f .. ' ' .. skang.things.f.help .. ' ' .. skang.things.fooble.help) +test.fooble = nil +print('f is now ' .. test.fooble .. ' ' .. test.f .. ' ' .. skang.things.f.help .. ' ' .. skang.things.fooble.help) -- cgit v1.1