Small and quick fixes:
- setTheme, getTheme and loadTheme changed the wrong reference - XML changed number properties to be usable with reactive values
This commit is contained in:
@@ -185,14 +185,14 @@ local themeAPI = {}
|
|||||||
--- @shortDescription Sets a new theme
|
--- @shortDescription Sets a new theme
|
||||||
--- @param newTheme table The theme configuration to set
|
--- @param newTheme table The theme configuration to set
|
||||||
function themeAPI.setTheme(newTheme)
|
function themeAPI.setTheme(newTheme)
|
||||||
defaultTheme = newTheme
|
themes.default = newTheme
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets the current theme configuration
|
--- Gets the current theme configuration
|
||||||
--- @shortDescription Gets the current theme
|
--- @shortDescription Gets the current theme
|
||||||
--- @return table theme The current theme configuration
|
--- @return table theme The current theme configuration
|
||||||
function themeAPI.getTheme()
|
function themeAPI.getTheme()
|
||||||
return defaultTheme
|
return themes.default
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Loads a theme from a JSON file
|
--- Loads a theme from a JSON file
|
||||||
@@ -203,7 +203,7 @@ function themeAPI.loadTheme(path)
|
|||||||
if file then
|
if file then
|
||||||
local content = file.readAll()
|
local content = file.readAll()
|
||||||
file.close()
|
file.close()
|
||||||
defaultTheme = textutils.unserializeJSON(content)
|
themes.default = textutils.unserializeJSON(content)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ local function parseXML(self, xmlString)
|
|||||||
|
|
||||||
for line in xmlString:gmatch("[^\r\n]+") do
|
for line in xmlString:gmatch("[^\r\n]+") do
|
||||||
line = line:match("^%s*(.-)%s*$")
|
line = line:match("^%s*(.-)%s*$")
|
||||||
self.basalt.LOGGER.debug("Parsing line: " .. line)
|
|
||||||
|
|
||||||
if line:match("^<!%[CDATA%[") then
|
if line:match("^<!%[CDATA%[") then
|
||||||
inCDATA = true
|
inCDATA = true
|
||||||
@@ -86,6 +85,9 @@ local function convertValue(value, propertyType, scope)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if propertyType == "number" then
|
if propertyType == "number" then
|
||||||
|
if(tonumber(value) == nil) then
|
||||||
|
return value
|
||||||
|
end
|
||||||
return tonumber(value)
|
return tonumber(value)
|
||||||
elseif propertyType == "boolean" then
|
elseif propertyType == "boolean" then
|
||||||
return value == "true"
|
return value == "true"
|
||||||
|
|||||||
Reference in New Issue
Block a user