mardi 24 décembre 2019

Splitting a string using multiple Lua patterns

So essentially I want to split a string using non fixed amount of lua patterns.

I'm currently working on a layouting system that involves parsing some sequences of characters such as :this: for example. For rendering the layout I have components that can be chunk of texts, images, or font modifiers for example. These components are the reason why I need to split/explode a string using multiple patterns. Because the patterns can match significantly different texts, and that lua patterns do not support "or" I've been stuck for a while on this problem.

I have tried messing with the string.gmatch function without success, any help is greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire