--- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by matheuswhite. --- DateTime: 23/01/24 18:42 --- function bytes2str(bytes) msg_str = '' for _, byte in pairs(bytes) do msg_str = msg_str .. string.char(byte) end return msg_str end function str2bytes(str) bytes = {} for _, c in utf8.codes(str) do table.insert(bytes, c) end return bytes end function osname() if os.getenv('OS') == 'Windows_NT' then return "win" else return "unix" end end scope = { println = function(msg) coroutine.yield({ ":println", msg }) end, eprintln = function(msg) coroutine.yield({ ":eprintln", msg }) end, connect = function(port, baud_rate) coroutine.yield({ ":connect", port, baud_rate }) end, disconnect = function() coroutine.yield({ ":disconnect" }) end, serial_tx = function(msg) coroutine.yield({ ":serial_tx", msg }) end, sleep = function(time) coroutine.yield({ ":sleep", time }) end, exec = function(cmd, quiet) quiet = quiet or false local _, stdout, stderr = coroutine.yield({ ":exec", cmd, quiet }) return stdout, stderr end, info = function() local _, output = coroutine.yield({ ":info" }) return output end }