Lua Table Converter

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

Moderators: Forum Moderators, Developers

Post Reply
Posts: 215
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
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: ... verter.lua
Creator of Choicerer's Map Randomizer - Better Odds -
The Better Names Mod - Architecture Mod -
Curse of Satan Claus - The Trolling Mod -
and the Mushroom Isar.

Post Reply