Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: fvrdam on October 14, 2021, 05:18:48 PM

Title: http.request in macro not working in GUI, works fine in editor
Post by: fvrdam on October 14, 2021, 05:18:48 PM

I've added a macro for M8/M9 to switch my dust collector.
This one is controllerd by http, so I have the following code for M8:

Code: [Select]
function m8()
inst=mc.mcGetInstance()
mc.mcCntlSetLastError(inst, 'Dust Col on')
local http=require("socket.http");
http.request("http://shop.local/api.php?port=99&action=on&hash=hash_here")

end

if (mc.mcInEditor() == 1) then
 m8()
end

In the editor this works fine,but when called through g-code the http.request is not working.
I know the code is working since the 'mcCntlSetLastError' is triggered

Anyone any suggestion ?