aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lexlua/lexer.lua5
-rw-r--r--test/test_lexlua.lua2
2 files changed, 5 insertions, 2 deletions
diff --git a/lexlua/lexer.lua b/lexlua/lexer.lua
index 0a92f6064..3f24dd79c 100644
--- a/lexlua/lexer.lua
+++ b/lexlua/lexer.lua
@@ -886,7 +886,10 @@ end
-- @name colors
-- @class table
M.colors = setmetatable({}, {
- __index = function(_, name) return M.property['color.' .. name] end,
+ __index = function(_, name)
+ local color = M.property['color.' .. name]
+ return tonumber(color) or color
+ end,
__newindex = function(_, name, color) M.property['color.' .. name] = color end
})
diff --git a/test/test_lexlua.lua b/test/test_lexlua.lua
index 602f480c7..de047c818 100644
--- a/test/test_lexlua.lua
+++ b/test/test_lexlua.lua
@@ -1181,7 +1181,7 @@ function test_colors()
assert(lexer.colors.red == '')
assert(lexer.property['color.red'] == '')
lexer.colors.red = 0x0000FF
- assert(lexer.colors.red == tostring(0x0000FF))
+ assert(lexer.colors.red == 0x0000FF)
assert(lexer.property['color.red'] == tostring(0x0000FF))
lexer.colors.blue = '#0000FF'
assert(lexer.colors.blue == '#0000FF')