/** * Writes the specified line to the serial port. * The call will block until all characters are written. * * Lua Params: * port - the serial port to write * (SERIAL_USB, SERIAL_GPS, SERIAL_TELEMETRY, SERIAL_WIRELESS, SERIAL_AUX) * line - the string to write. A newline will automatically be added at the end. * * Lua Returns: * no return values (nil) * */ int Lua_WriteSerialLine(lua_State *L) { if (lua_gettop(L) >= 2) { int serialPort = lua_tointeger(L,1); Serial *serial = get_serial(serialPort); if (serial) { const char * data = lua_tostring(L, 2); serial->put_s(data); serial->put_s("\n"); } } return 0; }