diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-28 16:40:16 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-28 16:40:16 +0000 |
commit | dffee8499755c8d949733677cf73e3f227ee12cd (patch) | |
tree | 2d815e21aa6b98330ebf8595ac2605c295832461 /crawl-ref/source | |
parent | 0371e07ab64fc457f74a6640f06a5b439038ceee (diff) | |
download | crawl-ref-dffee8499755c8d949733677cf73e3f227ee12cd.tar.gz crawl-ref-dffee8499755c8d949733677cf73e3f227ee12cd.zip |
Add the field CLASS to the metatable of each class, containing the name of the
class, so that table_to_string() can describe the class of each object.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8840 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/dat/clua/lm_1way.lua | 1 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_flags.lua | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_fog.lua | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_pdesc.lua | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_props.lua | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_timed.lua | 3 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_tmsg.lua | 4 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/lm_toll.lua | 1 | ||||
-rw-r--r-- | crawl-ref/source/dat/clua/util.lua | 8 |
9 files changed, 17 insertions, 8 deletions
diff --git a/crawl-ref/source/dat/clua/lm_1way.lua b/crawl-ref/source/dat/clua/lm_1way.lua index 185295c476..d2ac77c4cf 100644 --- a/crawl-ref/source/dat/clua/lm_1way.lua +++ b/crawl-ref/source/dat/clua/lm_1way.lua @@ -4,6 +4,7 @@ ------------------------------------------------------------------------------ OneWayStair = util.subclass(PortalDescriptor) +OneWayStair.CLASS = "OneWayStair" function OneWayStair:activate(marker) local ev = dgn.dgn_event_type('player_climb') diff --git a/crawl-ref/source/dat/clua/lm_flags.lua b/crawl-ref/source/dat/clua/lm_flags.lua index b042511f19..4660fa5abb 100644 --- a/crawl-ref/source/dat/clua/lm_flags.lua +++ b/crawl-ref/source/dat/clua/lm_flags.lua @@ -55,7 +55,7 @@ -- "the Orb of Zot" or "a golden rune of Zot"). -------------------------------------------------------------------------- -ChangeFlags = { } +ChangeFlags = { CLASS = "ChangeFlags" } ChangeFlags.__index = ChangeFlags function ChangeFlags:_new() diff --git a/crawl-ref/source/dat/clua/lm_fog.lua b/crawl-ref/source/dat/clua/lm_fog.lua index 3265c0e3bf..6fe49c6d66 100644 --- a/crawl-ref/source/dat/clua/lm_fog.lua +++ b/crawl-ref/source/dat/clua/lm_fog.lua @@ -50,7 +50,7 @@ -- are cleared when the player leaves a level. ------------------------------------------------------------------------------ -FogMachine = { } +FogMachine = { CLASS = "FogMachine" } FogMachine.__index = FogMachine function FogMachine:_new() diff --git a/crawl-ref/source/dat/clua/lm_pdesc.lua b/crawl-ref/source/dat/clua/lm_pdesc.lua index 4d3fc4b28a..49b6273680 100644 --- a/crawl-ref/source/dat/clua/lm_pdesc.lua +++ b/crawl-ref/source/dat/clua/lm_pdesc.lua @@ -3,7 +3,7 @@ -- Portal descriptor markers. ------------------------------------------------------------------------------ -PortalDescriptor = { } +PortalDescriptor = { CLASS = "PortalDescriptor" } PortalDescriptor.__index = PortalDescriptor function PortalDescriptor:new(properties) diff --git a/crawl-ref/source/dat/clua/lm_props.lua b/crawl-ref/source/dat/clua/lm_props.lua index 03c746eb32..05f71fb4ba 100644 --- a/crawl-ref/source/dat/clua/lm_props.lua +++ b/crawl-ref/source/dat/clua/lm_props.lua @@ -3,7 +3,7 @@ -- Property markers. ------------------------------------------------------------------------------ -PropertiesDescriptor = { } +PropertiesDescriptor = { CLASS = "PropertiesDescriptor" } PropertiesDescriptor.__index = PropertiesDescriptor function PropertiesDescriptor:new(properties) diff --git a/crawl-ref/source/dat/clua/lm_timed.lua b/crawl-ref/source/dat/clua/lm_timed.lua index 37be6998d9..a36f8aeaa8 100644 --- a/crawl-ref/source/dat/clua/lm_timed.lua +++ b/crawl-ref/source/dat/clua/lm_timed.lua @@ -7,6 +7,7 @@ require('clua/lm_tmsg.lua') require('clua/lm_1way.lua') TimedMarker = util.subclass(OneWayStair) +TimedMarker.CLASS = "TimedMarker" function TimedMarker:new(props) props = props or { } @@ -108,4 +109,4 @@ end function timed_marker(pars) return TimedMarker:new(pars) -end
\ No newline at end of file +end diff --git a/crawl-ref/source/dat/clua/lm_tmsg.lua b/crawl-ref/source/dat/clua/lm_tmsg.lua index 7ffecddc21..91b3bfdb9b 100644 --- a/crawl-ref/source/dat/clua/lm_tmsg.lua +++ b/crawl-ref/source/dat/clua/lm_tmsg.lua @@ -3,7 +3,7 @@ -- Messaging for timed Lua markers. ------------------------------------------------------------------------------ -TimedMessaging = { } +TimedMessaging = { CLASS = "TimedMessaging" } TimedMessaging.__index = TimedMessaging function TimedMessaging:new(m, nocheck) @@ -229,4 +229,4 @@ function time_messages(total_turns, ...) end table.insert(res, { 0, messages[n] }) return res -end
\ No newline at end of file +end diff --git a/crawl-ref/source/dat/clua/lm_toll.lua b/crawl-ref/source/dat/clua/lm_toll.lua index 4f5ed4bed0..dfc8fbf5af 100644 --- a/crawl-ref/source/dat/clua/lm_toll.lua +++ b/crawl-ref/source/dat/clua/lm_toll.lua @@ -6,6 +6,7 @@ require("clua/lm_1way.lua") TollStair = util.subclass(OneWayStair) +TollStair.CLASS = "TollStair" function TollStair:new(props) local toll = self.super.new(self, props) diff --git a/crawl-ref/source/dat/clua/util.lua b/crawl-ref/source/dat/clua/util.lua index 2aa4f2fe85..ceff124f91 100644 --- a/crawl-ref/source/dat/clua/util.lua +++ b/crawl-ref/source/dat/clua/util.lua @@ -230,7 +230,7 @@ end ---------------------------------------------------------- -util.Timer = { } +util.Timer = { CLASS = "Timer" } util.Timer.__index = util.Timer function util.Timer:new(pars) @@ -260,6 +260,12 @@ function table_to_string(table, depth) local str = "" + local meta = getmetatable(table) + + if meta and meta.CLASS then + str = str .. indent .. "CLASS: " .. meta.CLASS .. "\n" + end + for key, value in pairs(table) do str = str .. indent .. key .. ": " |