diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 82ebb11..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lua-json"] - path = lua-json - url = https://git.noordstar.me/Bram/lua-json.git diff --git a/README.md b/README.md index 4693232..ebdcc30 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This repository serves as a bridge between Matrix and Minetest servers. 1. Clone this repository into your Minetest mods folder: ```sh -git clone --recursive https://git.noordstar.me/Bram/mt-matrix.git +git clone https://git.noordstar.me/Bram/mt-matrix.git ``` 2. To access the Matrix homeserver, this mod needs access to HTTP calls. Add this mod to your `minetest.conf` settings at the field `secure.http_mods`: diff --git a/init.lua b/init.lua index aa9a735..b439da8 100644 --- a/init.lua +++ b/init.lua @@ -17,13 +17,6 @@ end -- Load standard configuration load("config") --- Load JSON module -json = nil -load("lua-json/json") -if json == nil then - error("Failed to load JSON module") -end - -- Load Matrix modules matrix = {} load("lua/send") diff --git a/lua-json b/lua-json deleted file mode 160000 index 261adde..0000000 --- a/lua-json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 261adde7a76687db142641d50cf4ed29873ec476 diff --git a/lua/send.lua b/lua/send.lua index cf1e4d9..98c6c59 100644 --- a/lua/send.lua +++ b/lua/send.lua @@ -8,7 +8,7 @@ function matrix.send_message(http_api, body, formatted_body, callback, txnId) config.url .. "/_matrix/client/v3/rooms/" .. config.room_id .. "/send/m.room.message/" .. txnId ), - data = json.encode({ + data = minetest.write_json({ msgtype = "m.text", body = body, format = "org.matrix.custom.html", @@ -22,7 +22,7 @@ function matrix.send_message(http_api, body, formatted_body, callback, txnId) minetest.debug(result.data) else if callback ~= nil then - callback(json.decode(result.data)) + callback(minetest.parse_json(result.data)) end end end) diff --git a/lua/sync.lua b/lua/sync.lua index c199e8c..bcaaff3 100644 --- a/lua/sync.lua +++ b/lua/sync.lua @@ -22,7 +22,7 @@ function matrix.sync(http_api, callback, global_callback) minetest.debug("Failed to sync with Matrix server; received code " .. result.code) minetest.debug(result.data) else - local answer = json.decode(result.data) + local answer = minetest.parse_json(result.data) if answer.next_batch ~= nil then sync_so_far = answer.next_batch