I would like to convert a string into an equation that can be evaluated.
I’m loading in properties for items in an RPG. So say the item is a sword, one of the properties would be the equation to calculate damage. This property is loaded in as a string, ‘str/4’. Meaning the characters strength divided by 4.
so for example:
item_damage = ‘str/4’ //this is actually loaded from the xml
str = 12
I want to evaluate this:
damage = str/4 //should equal 3
Anyone have any ideas?