Currently Lua doesn’t have an easy way to add default argument values in case you want to give your function parameters default values when they don’t exist.
What I want:
local function foo(a = 1, b = "something")
print(a, b) -- 1 something
end
foo(a, b)
What we currently must do:
local function foo(a, b)
a = a or 1
b = b or "something"
print(a, b) -- 1 something
end
foo(a, b)