It should not declare localized variables as global ones.
Actual Behavior
The code report detects an issue in actually localized variable, which it defines as a global one. The code report ignores if you prior localized the variable name. I actually do not know if it is a global issue related to localizing prior or just related to do blocks.
It returns an issue called: _Global function definitions are prohibited. Namespace them inside your addon's global table_.
Example:
local split do
local len = string.len
local sub = string.sub
local maxBytes = netchunk.maxBytes
function split(data)
local length = len(data)
local index = 1
local last = 1
local chunks = {}
for i = 1, length do
if (i - last + 1) > maxBytes then
chunks[index] = sub(data, last, i)
index = index + 1
last = i + 1
end
end
chunks[index] = sub(data, last, length)
return chunks
end
end
Result:
Reproduction Steps
1. Paste somewhere in the code the example above.
2. Run code report.
3. Check the issues.
Expected Behavior
It should not declare localized variables as global ones.
Actual Behavior
The code report detects an issue in actually localized variable, which it defines as a global one. The code report ignores if you prior localized the variable name. I actually do not know if it is a global issue related to localizing prior or just related to
do
blocks.It returns an issue called:
_Global function definitions are prohibited. Namespace them inside your addon's global table_
.Example:
Result:
Reproduction Steps
Browsers
Vivaldi
Example URL
https://www.gmodstore.com/dashboard/products/onyx-scoreboard-a-modern-scoreboard/code-reports/rkhUPOF8QBqvkzAf40Ew7g
Pivity Marketplace Version
v18.4.0
Event ID
No response
Additional Information
No response