09-11-2016, 05:18 PM
(This post was last modified: 09-11-2016, 05:37 PM by Seadragon91.)
Found a nice tool for checking lua code and added it as a external tool in Decoda
Name: luacheck
link: https://github.com/mpeterv/luacheck
As external tool in Decoda:
Title: Luacheck
Command: luacheck
Arguments: $(ItemDir) -g -a
-g ignore global variables, for example cPluginManger
-a ignore unused function arguments
With this 2 flags it creates a useful output.
Edit: Here a small output from Core
Warnings:
Core\banlist.lua:251:9: unused variable 'Reason'
Core\banlist.lua:253:9: unused variable 'Reason'
As you see the variable Reason is defined inside of a if block and Reason is nil here
Name: luacheck
link: https://github.com/mpeterv/luacheck
As external tool in Decoda:
Title: Luacheck
Command: luacheck
Arguments: $(ItemDir) -g -a
-g ignore global variables, for example cPluginManger
-a ignore unused function arguments
With this 2 flags it creates a useful output.
Edit: Here a small output from Core
Warnings:
Core\banlist.lua:251:9: unused variable 'Reason'
Core\banlist.lua:253:9: unused variable 'Reason'
Code:
-- If the player supplied a reason, use that, else use a default reason.
if (a_Split[3] ~= nil) then
local Reason = table.concat(a_Split, " ", 3)
else
local Reason = "No reason."
end
-- Add the player to the banlist:
AddPlayerToBanlist(a_Split[2], Reason, a_Player:GetName());
As you see the variable Reason is defined inside of a if block and Reason is nil here