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

Method apiGetInt

src/macro.cpp:130–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128 return 0;
129}
130duk_ret_t Macro::apiGetInt(duk_context *context) {
131 duk_idx_t numArgs = duk_get_top(context);
132 if( numArgs == 2 ) {
133 if( duk_get_type(context, 0) == DUK_TYPE_NUMBER && duk_get_type(context, 1) == DUK_TYPE_NUMBER ) {
134 duk_uint_t row = duk_to_uint(context, 0);
135 duk_uint_t col = duk_to_uint(context, 1);
136 std::string cell_str = macro.table->getCell(row, col);
137 try {
138 long cell_int = std::stol(cell_str);
139 duk_push_int(context, cell_int);
140 } catch(...) {
141 return 0;
142 }
143 return 1;
144 }
145 }
146 return 0;
147}
148duk_ret_t Macro::apiGetFloat(duk_context *context) {
149 duk_idx_t numArgs = duk_get_top(context);
150 if( numArgs == 2 ) {

Callers

nothing calls this directly

Calls 1

getCellMethod · 0.80

Tested by

no test coverage detected