You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add a formatter to the configuration file. I run into a strange problem. I cannot use standard lua functions. for pairs, ipairs, table functions are not recognized.
I'm using the current latest version of the windows precompiled binairy of luacheck. Rest of config is empty.
This works:
formatter = function(report, filenames, combined_opts)
return "Test 1\r\nTest 2\r\n"
end
This fails with error
Critical error: Couldn't run custom formatter 'function: 00000177b50307f0': [string "chunk"]:3: attempt to call a nil value (global 'pairs')
formatter = function(report, filenames, combined_opts)
local days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
for j, i in pairs(days) do
end
return ""
end
The text was updated successfully, but these errors were encountered:
I fixed it by using the not a function but a custom formatter name.
Added next in the config file. formatter = "customFormatter"
Next in the customFormatter.lua
return function(report, filenames, combined_opts)
local days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
for j, i in pairs(days) do
end
return ""
end
Of course the content of the function is useless as a formatter. But is executed without errors.
I'm trying to add a formatter to the configuration file. I run into a strange problem. I cannot use standard lua functions. for pairs, ipairs, table functions are not recognized.
I'm using the current latest version of the windows precompiled binairy of luacheck. Rest of config is empty.
This works:
This fails with error
The text was updated successfully, but these errors were encountered: