(LuaTable table)
| 10 | public class ScriptUtils { |
| 11 | |
| 12 | public static HashMap<Object, Object> toMap(LuaTable table) { |
| 13 | HashMap<Object, Object> map = new HashMap<>(); |
| 14 | LuaValue[] rootKeys = table.keys(); |
| 15 | for (LuaValue k : rootKeys) { |
| 16 | if (table.get(k).istable()) { |
| 17 | map.put(k, toMap(table.get(k).checktable())); |
| 18 | } else { |
| 19 | map.put(k, table.get(k)); |
| 20 | } |
| 21 | } |
| 22 | return map; |
| 23 | } |
| 24 | |
| 25 | public static void print(LuaTable table) { |
| 26 | Grasscutter.getLogger().info(toMap(table).toString()); |
no test coverage detected