Lua Table Converter

Discussion of Lua and LuaWML support, development, and ideas.

Moderators: Forum Moderators, Developers

Post Reply
Choicerer
Posts: 214
Joined: April 29th, 2017, 11:37 pm

Lua Table Converter

Post by Choicerer » May 23rd, 2018, 9:40 am

Hi all,
Porting my Randomizer to Lua and then realising global variables aren't stored in the savefile forced me to come up with this lua table converter.
I hope you can find it useful, here is the description from Readme.md:
This script converts between regular lua and lua wml tables. It is inteded to be used to convert lua tables with any number of subtables indexed by indices, keys or both to WML and back while preserving the original structure.
It will only work for wml tables that are prefixed by a [1] index, that is any subtables must go inside that [1] and it must be the only top index. The rationale for this is that there must be a consistent way of preserving lua table structure, so that after converting a lua table to wml and back, we end up with the exact same table. This is the only way this can be accomplished, if you have a wml table with multiple top indices, you will want to run helper.get_variable_array on it, anyway.
Get it here:
https://github.com/Choicerer/Wesnoth_Ta ... verter.lua
Creator of Choicerer's Map Randomizer - http://bit.ly/2GNcnuv Better Odds - http://bit.ly/2HP41ln
The Better Names Mod - http://bit.ly/2ICIGwz Architecture Mod - http://bit.ly/2JjbNsN
Curse of Satan Claus - http://bit.ly/2pq6MSg The Trolling Mod - http://bit.ly/2GbpAiO
and the Mushroom Isar.

Post Reply