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LCMN4HLGC5DQC P6MGPZQVKLKELXN5SKFHTEWSUMFUCQGRGHZQZEL2GH5IXUOJ4T7AC TGAAKKGGQZ6V6V25DGVHDXUXR74OYGG7RGRXVWKASDCONXZ63LYAC -- the communication channel with the app-- commands are processed on the other end, in the appfunction live.send_definition_to_app(State)local current_buffer = live.definition_to_string(State)State.saved = truelocal definition_name = live.get_cmd_from_buffer(current_buffer)live.send_to_app(current_buffer)endfunction live.send_to_app(msg)Load_time_error = nilRun_time_error = nil-- first clear the response buffer from any previous commandslocal clear = io.open(love.filesystem.getAppdataDirectory()..'/_love_akkartik_app_driver', 'w')clear:close()-- send a fresh commandlocal f = io.open(love.filesystem.getAppdataDirectory()..'/_love_akkartik_driver_app', 'w')if f == nil then return endf:write(msg)f:close()print('$'..color(--[[bold]]1, --[[blue]]4))print(msg)print(reset_terminal())end-- look for a message from outside, and return nil if there's nothing-- if there's an error, save it and return ''function live.receive_from_app()local f = io.open(love.filesystem.getAppdataDirectory()..'/_love_akkartik_app_driver')if f == nil then return nil endlocal result = f:read('*a')f:close()if result == '' then return nil end -- empty file == no messageprint('=>'..color(0, --[[green]]2))print(result)print(reset_terminal())if result:match('^ERROR ') thenLoad_time_error = result:sub(#('ERROR '))endreturn resultendfunction live.receive_run_time_error_from_app()local f = io.open(love.filesystem.getAppdataDirectory()..'/_love_akkartik_app_driver_run_time_error')if f == nil then return nil endlocal result = f:read('*a')f:close()if result == '' then return nil end -- empty file == no messageprint('=>'..color(0, --[[red]]1))print(result)print(reset_terminal())Run_time_error = resultreturn resultendfunction live.definition_to_string(State)return table.concat(map(State.lines, function(line) return line.data end), '\n')endfunction map(arr, f)local result = {}for _, x in ipairs(arr) dotable.insert(result, f(x))endreturn resultendos.remove(love.filesystem.getAppdataDirectory()..'/_love_akkartik_app_driver_run_time_error')os.remove(love.filesystem.getAppdataDirectory()..'/_love_akkartik_app_driver')result = '{}'
* `live.receive_from_app()` -- receives a message from the client app,returning it or `nil` if no message was received. If the message is anerror, it's saved to `Load_time_error` and the call returns an emptyresponse `''`.
* `live.send_to_driver(msg)` -- sends a message to the driver.
* `live.receive_run_time_error_from_app()` -- checks for any run-time errorsin the client app, and populates them in `Run_time_error`. Automaticallyinvoked, so you shouldn't need to call this.
* `live.send_run_time_error_to_driver(msg)` -- sends an error to the driver.Automatically invoked by the LÖVE error handler, so you shouldn't need tocall this.
* `live.receive_from_driver()` -- looks for a message from the meta-driver,and returns nil if there's nothing.* `live.send_to_driver(msg)` -- sends a message to the meta-driver.* `live.send_run_time_error_to_driver(msg)` -- sends an error to themeta-driver. Automatically invoked by the LÖVE error handler, so youshouldn't need to call this.
-- replif chord == 'f4' thenState.load_time_error = nillive.send_definition_to_app(State)while true dolocal response_string = live.receive_from_app()if response_string thenClient_app_test_failures = json.decode(response_string)breakendif live.receive_run_time_error_from_app() thenbreakendlove.timer.sleep(0.001)endif Load_time_error thenState.load_time_error = Load_time_errorLoad_time_error = nilendif on.code_submit then on.code_submit(State) end