From 98a652259b22bac73f576aaf4e0163b5453afa78 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Wed, 9 Oct 2019 00:16:42 +0200 Subject: [PATCH] test --- init.lua | 18 ++++++++++-------- test.json | 7 ++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index 5fe3adb..388cef5 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,8 @@ local toolrepair local progressive_mode = core.settings:get_bool("craftguide_progressive_mode") local sfinv_only = core.settings:get_bool("craftguide_sfinv_only") and rawget(_G, "sfinv") +local http = core.request_http_api() + local reg_items = core.registered_items local reg_tools = core.registered_tools local reg_aliases = core.registered_aliases @@ -1870,11 +1872,11 @@ register_command("craft", { end, }) -print(core.write_json({ - result = "default:cobble 16", - items = { - "default:stone, default:stone, default:stone", - "default:stone, , default:stone", - "default:stone, default:stone, default:stone", - } -})) +if http then + local data = http.fetch_async({ + url = "https://raw.githubusercontent.com/minetest-mods/craftguide/master/test.json", + }) + + print(type(data)) + print(core.parse_json(data)) +end \ No newline at end of file diff --git a/test.json b/test.json index 8b2e209..860d318 100644 --- a/test.json +++ b/test.json @@ -1,7 +1,8 @@ { - "items":[ + "items": [ "default:stone, default:stone, default:stone", "default:stone, , default:stone", - "default:stone, default:stone, default:stone"], - "result":"default:cobble 16" + "default:stone, default:stone, default:stone" + ], + "result": "default:cobble 16" } \ No newline at end of file