Crafting system list sorting?

So I have this crafting system where you can input the materials randomly and the issue is that how can i sort the list into the actual crafting recipe otherwise there is only one way to perform it . Im looking for a way to sort the list of input materials to match up with the crafting recipe order. Not looking for a script.

I guess you could sort both the recipe and the input ingredients in alphabetical order? I think that’s what a table.sort call would do if you don’t specific a custom sorting function.