From 0d88c472fa87d0805fdd7f7a8086118386afe2e7 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 5 Sep 2024 02:33:40 +0200 Subject: [PATCH] fix: export open function --- mqtt.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mqtt.lua b/mqtt.lua index 136a021..e0427e9 100644 --- a/mqtt.lua +++ b/mqtt.lua @@ -1,4 +1,4 @@ -local net = require("internet") +local mqtt = {} local read_varint = function (conn, first_byte) local b @@ -26,10 +26,10 @@ local read_varint = function (conn, first_byte) return n + (b << s), nil end -local MqttClient +local MqttClient = {} -function open (address, port) - local conn = net.open(address, port) +function mqtt.open (address, port) + local conn = require("internet").open(address, port) if conn == nil then return nil, "connection failed" end @@ -171,3 +171,5 @@ function MqttClient:disconnect (reason) return nil end + +return mqtt