MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / apiPrintln

Method apiPrintln

src/macro.cpp:184–205  ·  view source on GitHub ↗

* Prints the given arguments into the log area */

Source from the content-addressed store, hash-verified

182 * Prints the given arguments into the log area
183 */
184duk_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

Callers

nothing calls this directly

Calls 2

to_stringFunction · 0.85
updateMacroLogBufferFunction · 0.85

Tested by

no test coverage detected