Skip to content

Commit 4cd20ce

Browse files
committed
Add themepark object as parameter to the themes init.lua functions
1 parent 7ccf332 commit 4cd20ce

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lua/themepark.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,15 @@ function themepark:init_theme(theme)
157157
end
158158
local file = io.open(theme_file)
159159
if file then
160-
themepark.themes[theme] = dofile(theme_file)
160+
local script = file:read('a*')
161+
file:close()
162+
163+
local func, msg = load(script, theme_file, 't')
164+
if not func then
165+
error('Loading ' .. theme_file .. ' failed: ' .. msg)
166+
end
167+
168+
themepark.themes[theme] = func(self)
161169
themepark.themes[theme].dir = theme_dir
162170
break
163171
end

themes/basic/init.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
--
55
-- ---------------------------------------------------------------------------
66

7+
local themepark = ...
8+
79
local theme = {}
810

911
local function init_polygon_lookup()

0 commit comments

Comments
 (0)