How to use Default parameter values in Lua
Posted: Thu Sep 07, 2023 4:31 pm
Hi Tony,
I have registered some Cs functions to Lua, with some parameters like:
Now I use this in Dialogue Database like so:
Can I just omit some parameters to make that easier?(omitted parameters can be placed at the end)
I have registered some Cs functions to Lua, with some parameters like:
Code: Select all
// csharp: Func(string a, int b=0)
Lua.RegisterFunction(nameof(Func), this, SymbolExtensions.GetMethodInfo(() => Func(string.Empty, 0)));
Code: Select all
// lua
Func("blah") // TargetParameterCountException: Number of parameters specified does not match the expected number.
Func("blah", 0) // it's ok, but too long