Page 1 of 1

Lua.RegisterFunction with enums

Posted: Thu Nov 16, 2023 6:50 pm
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);
        }
        

Re: Lua.RegisterFunction with enums

Posted: Thu Nov 16, 2023 7:59 pm
by Tony Li
Hi,

Lua doesn't have enums, but there's a suggestion in this post.

Re: Lua.RegisterFunction with enums

Posted: Fri Nov 17, 2023 12:05 am
by lemonjolly_anna
Amazing thanks!

Re: Lua.RegisterFunction with enums

Posted: Fri Nov 17, 2023 7:43 am
by Tony Li
Glad to help!