function error(player,str)
player.surface.create_entity{name="flying-text",position=player.position, text=str, render_player_index = player.index}
end
Please, change that name of function because of lua "error" function.
Can you add "get_mana_ratio" function in your mod interface like "get_health_ratio" function from the Factorio API?
If you use your mod with other mods/scenarios related with buttons etc, then your mana UI will be shifted to the right.
You have "global.version". Probably, migration files can help with that check instead of using "script.on_configuration_changed"...
That it's all, too much information for today :P