-- Короткой формы нет: лямбда - выражение function(x) ... end,
-- хранимое в переменной
local pow_of_two = function(power)
return 2 ^ power
end
local pow8 = pow_of_two(8)
-- pow8 = 256.0
-- То же в именованной форме
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)