-- No short form: a lambda is the expression
-- function(x) ... end, kept in a variable
local pow_of_two = function(power)
return 2 ^ power
end
local pow8 = pow_of_two(8)
-- pow8 = 256.0
-- The same in the named form
local function pow_of_three(power)
return 3 ^ power
end
local pow3 = pow_of_three(3)
-- pow3 = 27.0
print("pow8 = " .. pow8)
print("pow3 = " .. pow3)