Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function register_persitent_tag(name, reader, writer)
  2. old_on_load = wesnoth.game_events.on_load
  3. old_on_save = wesnoth.game_events.on_save
  4. function wesnoth.game_events.on_load(cfg)
  5. for i = 1, #cfg
  6. if cfg[i][1] == name then
  7. reader(cfg[i][2])
  8. end
  9. end
  10. old_on_load(cfg)
  11. end
  12. function wesnoth.game_events.on_save(cfg)
  13. local res = old_on_save()
  14. table.insert(res, { name, writer()})
  15. return res
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement