diff options
| author | mitchell <unknown> | 2020-07-13 15:18:05 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2020-07-13 15:18:05 -0400 |
| commit | c8415f6bb194477fcdd8a9f0c6f8551f1749e6b6 (patch) | |
| tree | a81a96a65433218089e580de280a67b1dc7bf493 | |
| parent | be2b4322cbb398b33ee9641d04463b663c781e1a (diff) | |
| download | scintilla-mirror-c8415f6bb194477fcdd8a9f0c6f8551f1749e6b6.tar.gz | |
lexlua: Return `lexer.colors.name` as a number if possible.
| -rw-r--r-- | lexlua/lexer.lua | 5 | ||||
| -rw-r--r-- | test/test_lexlua.lua | 2 |
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') |
