* Prints the given arguments into the log area */
| 182 | * Prints the given arguments into the log area |
| 183 | */ |
| 184 | duk_ret_t Macro::apiPrintln(duk_context *context) { |
| 185 | std::string str; |
| 186 | duk_idx_t numArgs = duk_get_top(context); |
| 187 | for( int i = 0; i < numArgs; ++i ) { |
| 188 | if( duk_get_type(context, i) == DUK_TYPE_STRING ) { |
| 189 | str = duk_safe_to_string(context, i); |
| 190 | } else if( duk_get_type(context, i) == DUK_TYPE_NUMBER ) { |
| 191 | str = std::to_string(duk_to_number(context, i)); |
| 192 | str.erase(str.find_last_not_of("0")+1); |
| 193 | str.erase(str.find_last_not_of(".")+1); |
| 194 | } else { |
| 195 | str = ""; |
| 196 | } |
| 197 | if( Macro::logDisplay ) { |
| 198 | updateMacroLogBuffer(Macro::logDisplay, str); |
| 199 | } |
| 200 | } |
| 201 | if( Macro::logDisplay ) { |
| 202 | updateMacroLogBuffer(Macro::logDisplay, " \n"); |
| 203 | } |
| 204 | return 0; |
| 205 | } |
| 206 | |
| 207 | |
| 208 |
nothing calls this directly
no test coverage detected