Lua.RegisterFunction with enums

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Lua.RegisterFunction with enums

Post by lemonjolly_anna »

Hello! :)

Is it possible to have enums when registering a custom Lua function?
e.g.

Code: Select all

	public enum ShopType
        {
            general,
            card,
            cardDiscard,
            randomCard,
            randomItem,
            ingredient,
            randomIngredient,
            armour,
        }
        public ShopType shopType;
        
        
        
        Lua.RegisterFunction(nameof(TriggerShop), this, SymbolExtensions.GetMethodInfo
        (() => TriggerShop(DESIGNER INPUTS SHOPTYPE ENUM IN DIALOGUE EDITOR HERE)));
        
        
        
	public void TriggerShop(ShopType shopType)
        {
            InventoryManager.instance.ShowShop(shopType);
        }
        
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Lua.RegisterFunction with enums

Post by Tony Li »

Hi,

Lua doesn't have enums, but there's a suggestion in this post.
lemonjolly_anna
Posts: 17
Joined: Tue May 16, 2023 11:41 pm

Re: Lua.RegisterFunction with enums

Post by lemonjolly_anna »

Amazing thanks!
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: Lua.RegisterFunction with enums

Post by Tony Li »

Glad to help!
Post Reply