Skip to content

Commit 8fdff01

Browse files
committed
Error if / is missing in first parameter of add_topic()
1 parent f5869d0 commit 8fdff01

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lua/themepark.lua

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,22 @@ function themepark:init_theme(theme)
190190
end
191191

192192
-- ---------------------------------------------------------------------------
193+
-- add_topic(TOPIC, OPTIONS)
194+
--
195+
-- Add TOPIC. TOPIC consists of the THEME, a forward slash (/), and the topic
196+
-- in that theme. Will initialize the theme if that hasn't been done already.
197+
--
198+
-- OPTIONS is an optional key/value table with config options forwarded to the
199+
-- topic.
193200
-- ---------------------------------------------------------------------------
194-
function themepark:add_topic(topic, cfg)
201+
function themepark:add_topic(topic, options)
195202
local theme_name = ''
196203
local slash = string.find(topic, '/')
197204
if slash then
198205
theme_name = string.sub(topic, 1, slash - 1)
199206
topic = string.sub(topic, slash + 1)
207+
else
208+
error("Missing '/' in topic: " .. topic)
200209
end
201210

202211
local theme = self:init_theme(theme_name)
@@ -220,7 +229,7 @@ function themepark:add_topic(topic, cfg)
220229
error('Load failed: ' .. msg)
221230
end
222231

223-
local result = func(self, theme, cfg or {})
232+
local result = func(self, theme, options or {})
224233

225234
if self.debug then
226235
print("Themepark: Adding topic '" .. topic .. "' from theme '" .. theme_name .. "' done.")

0 commit comments

Comments
 (0)