Hey!
I was wondering if it was possible to pass in an enum as a parameter for custom Lua Functions. Or as an alternative, what is the best way to go about this issue.
I have a function in my CustomLuaFunctions script and was wondering if this was possible.
Cheers!
Custom Lua Functions - Adding Enum as a Parameter
-
- Posts: 10
- Joined: Wed Apr 27, 2022 11:01 pm
Re: Custom Lua Functions - Adding Enum as a Parameter
Hi,
Lua doesn't have enums. You can use strings. For example, your Script field might look like:
And your C# method might look like:
Lua doesn't have enums. You can use strings. For example, your Script field might look like:
Code: Select all
ChangeGameState("Paused")
Code: Select all
public enum GameState { MainMenu, Paused, Playing }
public void ChangeGameState(string stateName)
{
GameManager.State = Enum.Parse(typeof(GameState), stateName);
}