orbitalquark / scintillua

Scintillua enables Scintilla lexers to be written in Lua, particularly using LPeg. It can also be used as a standalone Lua library for syntax highlighting support.
https://orbitalquark.github.io/scintillua
MIT License
52 stars 22 forks source link

tests.lua fails with Lua 5.3 #28

Closed silasdb closed 3 years ago

silasdb commented 3 years ago

In #27 it was noted that tests.lua fail with Lua 5.3. @moesasji confirms that and @orbitalquark argues that defining _G.lpeg works. Indeed, the patch below made it work for Lua 5.3. Defining lpeg as a global is equivalent to define _G.lpeg, no?

diff --git a/tests.lua b/tests.lua
index 5e0af5d..bb19711 100644
--- a/tests.lua
+++ b/tests.lua
@@ -5,7 +5,7 @@ package.path = 'lexers/?.lua;'..package.path

 local lexer = require('lexer')
 local token, word_match = lexer.token, lexer.word_match
-local lpeg = require('lpeg')
+lpeg = require('lpeg')
 -- Scintilla normally defines these.
 lexer.FOLD_BASE, lexer.FOLD_HEADER, lexer.FOLD_BLANK = 0x400, 0x2000, 0x1000
orbitalquark commented 3 years ago

Fixed via https://github.com/orbitalquark/scintillua/commit/373f7db1ef98bc73816879c85da4eaf2075ff914

Thanks for confirming it works.