Hello Guest it is April 20, 2024, 12:32:03 AM

Author Topic: http.request in macro not working in GUI, works fine in editor  (Read 404 times)

0 Members and 1 Guest are viewing this topic.

http.request in macro not working in GUI, works fine in editor
« 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 ?