Whenever I write scripts, I often think that code files that take up less bytes would run faster. As such, instead of writing this:
local numValue = 1
local boolValue = true
local ItemInWorkspace = Instance.new("BasePart",workspace)
local nilValue
local CONSTANT_VALUE = 10
local function someFunction(parameter)
local valueInFunction = 1
if type(parameter) == "integer" then
return parameter + valueInFunction
end
end
I would write this:
numValue = 1
boolValue = true
ItemInWorkspace = Instance.new("BasePart",workspace)
nilValue = nil -- Just writing "nilValue" with neither "local " nor " = nil" is not accepted.
CONSTANT_VALUE = 10
function someFunction(parameter)
local valueInFunction = 1 -- This "local" is retained for obvious reasons.
if type(parameter) == "integer" then
return parameter + valueInFunction
end
end
Is it a good practice that you do not have to write local
outside functions and blocks? If it is not a good practice, please explain.