Or, instead of commenting out stuff, use versioning and revert if something doesn't work as you expected it to
(Might be overkill though, but it doesn't hurt learning git or something)
Or, instead of commenting out stuff, use versioning and revert if something doesn't work as you expected it to
I have been using Sourcetree and currently using TortoiseHG but all in due time
Code: Select all
local x = 2
do
local x = 6
print(x, "inside 1")
end
do
local x
print(x, "inside 2")
end
do
print(x, "inside 3")
end
Code: Select all
6 inside 1
nil inside 2
2 inside 3
Code: Select all
function complicatedComputation(a)
local fleeb
do -- compute fleeb
local foo = math.sqrt(a * math.pi ....
...
fleeb = ...
end
local turbulence
do -- figure out turbulence
...
end
return a/2 + fleeb * (math.random() - .5) * turbulence
end
Code: Select all
function something(parameter)
local result
do -- region one
local inner_scope_variable = "whatever"
result = inner_scope_variable
end
return result
end
Code: Select all
local function computeFleeb (a)
return math.sqrt(a * math.pi ....
end
local function figureOutTurbulence (...)
return ...
end
local function complicatedComputation(a)
local fleeb = computeFleeb(a)
local turbulence = figureOutTurbulence()
return a/2 + fleeb * (math.random() - .5) * turbulence
end
This can go both ways, really.nice wrote:By using regions in a project you can group up a lot of code, let's say you have this complex movement code for an enemy but you feel that it's a bit of a pain to scroll through to get to another part of the code, then regions is really good to have.
So does that kind of solution exist?
Users browsing this forum: slime and 2 guests