Parse MQTT connect function

This commit is contained in:
Ollo 2021-04-01 18:15:10 +02:00
parent 9508542158
commit 682201626c

View File

@ -107,8 +107,14 @@ private class ConnectMqtt extends VarArgFunction {
public LuaValue invoke(Varargs varargs) { public LuaValue invoke(Varargs varargs) {
final LuaTable onMqtt = new LuaTable(); final LuaTable onMqtt = new LuaTable();
if (varargs.narg() == 1) { if (varargs.narg() == 6) {
System.out.println("[MQTT] connect "); final LuaTable table = varargs.arg(1).checktable();
final String targetIP = varargs.arg(2).toString().toString();
final int portnumber = varargs.arg(3).toint();
final boolean unkownParameter = varargs.arg(4).toboolean();
final LuaValue codeOnConnected = varargs.arg(5);
final LuaValue codeOnFailed = varargs.arg(6);
System.out.println("[MQTT] connect to " + targetIP + ":" + portnumber);
} else { } else {
for(int i=0; i <= varargs.narg(); i++) { for(int i=0; i <= varargs.narg(); i++) {
System.err.println("[MQTT] connect ["+(i) + "] (" + varargs.arg(i).typename() + ") " + varargs.arg(i).toString() ); System.err.println("[MQTT] connect ["+(i) + "] (" + varargs.arg(i).typename() + ") " + varargs.arg(i).toString() );