Local variables inside a function are separate from local variables outside it.

Local Scope

local_scope.lua
local base = 

local function add_fee(amount)
  local fee = 3
  return amount + fee
end

local total = add_fee(base)

print("base=" .. base)
print("total=" .. total)
local base = 

local function add_fee(amount)
  local fee = 3
  return amount + fee
end

local total = add_fee(base)

print("base=" .. base)
print("total=" .. total)
local base = 

local function add_fee(amount)
  local fee = 3
  return amount + fee
end

local total = add_fee(base)

print("base=" .. base)
print("total=" .. total)
isolated names The same name can appear in different local scopes without sharing one value.