Add script for Luacheck

This commit is contained in:
Jean-Patrick Guerrero
2021-11-30 18:39:35 +01:00
parent 0b4250b54b
commit ab690398b7
5 changed files with 133 additions and 4 deletions

View File

@ -1,7 +1,7 @@
--[[ All source files have to be preprocessed before loading.
This allows implementing custom operators like bitwise ones. ]]
local fmt = string.format
local fmt, split = string.format, string.split
local var = "[%w%.%[%]\"\'_]"
local operators = {
@ -53,7 +53,7 @@ end
local function _load(path, line, data, t)
if line then
if not t then
t = data:split"\n"
t = split(data, "\n")
end
t[line] = t[line]:gsub("(" .. var .. "+)%s?=%s?(" .. var .. "*)", "%2")
data = table.concat(t, "\n")