Skip to content
Snippets Groups Projects
Commit 0c65651d authored by DarkGod's avatar DarkGod
Browse files

handke push code return

parent b4cb9b20
No related branches found
No related tags found
No related merge requests found
......@@ -514,10 +514,15 @@ end
function _M:eventPushCode(e)
local f, err = loadstring(e.code)
if not f then
-- core.profile.pushOrder("o='GetNews'")
if e.return_uuid then
core.profile.pushOrder(string.format("o='CodeReturn' uuid=%q data=%q", e.return_uuid, table.serialize{error=err}))
end
else
local ok, err = pcall(f)
if config.settings.cheat then print(ok, err) end
if e.return_uuid then
core.profile.pushOrder(string.format("o='CodeReturn' uuid=%q data=%q", e.return_uuid, table.serialize{result=ok and err, error=not ok and err}))
end
end
end
......
......@@ -23,7 +23,7 @@ local UserChat = require "profile-thread.UserChat"
module(..., package.seeall, class.make)
local debug = false
local debug = true
local mport = debug and 2259 or 2257
local pport = debug and 2260 or 2258
......@@ -656,11 +656,20 @@ end
-- Pushes comming from the push socket
--------------------------------------------------------------------
function _M:orderCodeReturn(o)
self:command("ARET", "RETURN", o.uuid, #o.data)
if self:read("200") then self.sock:send(o.data) end
end
function _M:pushCode(e)
if e.profile then
local f = loadstring(e.code)
if f then pcall(f) end
else
cprofile.pushEvent(string.format("e='PushCode' code=%q", e.code))
if e.return_uuid then
cprofile.pushEvent(string.format("e='PushCode' return_uuid=%q code=%q", e.return_uuid, e.code))
else
cprofile.pushEvent(string.format("e='PushCode' code=%q", e.code))
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment