diff --git a/luacs-docs/lua/lua/Game.lua b/luacs-docs/lua/lua/Game.lua
index c75257a0a..686a80687 100644
--- a/luacs-docs/lua/lua/Game.lua
+++ b/luacs-docs/lua/lua/Game.lua
@@ -25,7 +25,7 @@ Game.ServerSettings = true
Game.Settings = true
--- ChatBox.
--- @realm ChatBox
+-- @realm server
Game.ChatBox = true
--- Send chat message to every client.
diff --git a/luacs-docs/lua/templates/ldoc.ltp b/luacs-docs/lua/templates/ldoc.ltp
index d1b41430f..fb0491e73 100644
--- a/luacs-docs/lua/templates/ldoc.ltp
+++ b/luacs-docs/lua/templates/ldoc.ltp
@@ -23,13 +23,22 @@ function ldoc.asset_url(path)
end
function ldoc.realm_icon(realm)
+ assert(
+ realm == "server" or realm == "client" or realm == "shared",
+ string.format("WARNING: invalid realm '%s'", realm))
return ""
end
+function ldoc.realm_icon_from_item(item)
+ local realm = item.tags.realm
+ assert(type(realm) == "table" and #realm > 0, "missing @realm tag")
+ return ldoc.realm_icon(realm[1])
+end
+
function ldoc.sidebar_item(item, module)
local text = ""
- text = text .. ldoc.realm_icon(item.tags.realm[1])
+ text = text .. ldoc.realm_icon_from_item(item)
text = text .. ""
@@ -66,7 +75,7 @@ function ldoc.item_header(item)
end
text = text
- .. ldoc.realm_icon(item.tags.realm[1])
+ .. ldoc.realm_icon_from_item(item)
.. ldoc.display_name(item)
.. ""
.. ""