* */
| 91 | * |
| 92 | */ |
| 93 | duk_ret_t Macro::apiSetCell(duk_context *context) { |
| 94 | std::string str; |
| 95 | duk_idx_t numArgs = duk_get_top(context); |
| 96 | if( numArgs == 3 ) { |
| 97 | if( duk_get_type(context, 0) == DUK_TYPE_NUMBER && duk_get_type(context, 1) == DUK_TYPE_NUMBER) { |
| 98 | duk_uint_t row = duk_to_uint(context, 0); |
| 99 | duk_uint_t col = duk_to_uint(context, 1); |
| 100 | if( duk_get_type(context, 2) == DUK_TYPE_STRING ) { |
| 101 | str = duk_safe_to_string(context, 2); |
| 102 | } else if( duk_get_type(context, 2) == DUK_TYPE_NUMBER ) { |
| 103 | str = std::to_string(duk_to_number(context, 2)); |
| 104 | str.erase(str.find_last_not_of("0")+1); |
| 105 | str.erase(str.find_last_not_of(".")+1); |
| 106 | } else { |
| 107 | str = ""; |
| 108 | } |
| 109 | macro.table->setCell(str, row, col); |
| 110 | Macro::tableModified = true; |
| 111 | } |
| 112 | } |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | |
| 117 | duk_ret_t Macro::apiGetString(duk_context *context) { |