Access to the "formula" calculator for infinite technologies
Posted: Sat Feb 23, 2019 9:12 pm
I am writing a mod that calculates the cost of technologies for the Black Market. It uses the count and the ingredients.
For infinite technologies, there is no "count" properties but a "formula" property which allows to get the "count" based on the current level of the technology.
I managed to write a Lua code that evaluate the expression. Though it might not cover all the cases.
Thus I would like to have access the internal formula parser/calculator (as stated here https://www.factorio.com/blog/post/fff-161) from Lua.
Maybe something like :
For infinite technologies, there is no "count" properties but a "formula" property which allows to get the "count" based on the current level of the technology.
I managed to write a Lua code that evaluate the expression. Though it might not cover all the cases.
Thus I would like to have access the internal formula parser/calculator (as stated here https://www.factorio.com/blog/post/fff-161) from Lua.
Maybe something like :
Code: Select all
formula = "100(L-6)"
engine.formula_calc(formula, 3) -- not 'game.' as it would be nice to use it in the data stage as well.