CCCPaste

remote_execution_from_VSCODE

local WS_URL = "ws://127.0.0.1:10000/ws"

print("Csatlakozas: " .. WS_URL)
local ws, err = http.websocket(WS_URL)

if not ws then
printError("Sikertelen csatlakozas: " .. tostring(err))
return
end

print("Sikeresen csatlakozva! Varakozas a VS Code-ra...")

while true do
local event, url, message = os.pullEvent("websocket_message")

if url == WS_URL then
print("\n--- Uj kod futtatasa ---")

local func, syntax_err = load(message, "vscode_remote")

if not func then
printError("Szintaktikai hiba:")
printError(syntax_err)
else
local success, runtime_err = pcall(func)

if not success then
printError("Futasideju hiba:")
printError(runtime_err)
else
print("--- Futtatas vege ---")
end
end
end
end