Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("json")
- local ws, err = http.websocket("ws://5ffb03dfaa0d.ngrok.io/")
- if err then
- print(err)
- end
- if ws then
- print("> CONNECTED")
- while true do
- local message = ws.receive()
- print(message)
- local obj = json.decode(message)
- if obj.type == 'eval' then
- local func = loadstring(obj['function'])
- local result = func()
- ws.send(json.encode(result))
- print("> EVAL " .. tostring(result))
- end
- end
- end
Add Comment
Please, Sign In to add comment