| 342 | |
| 343 | |
| 344 | LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { |
| 345 | StkId o = index2adr(L, idx); |
| 346 | if (!ttisstring(o)) { |
| 347 | /* COMDB2 MODIFICATION */ |
| 348 | if (luabb_iscstring(L, idx)) { |
| 349 | const char *s = luabb_tocstring(L, idx); |
| 350 | if (len) *len = strlen(s); |
| 351 | return s; |
| 352 | } |
| 353 | lua_lock(L); /* `luaV_tostring' may create a new string */ |
| 354 | if (!luaV_tostring(L, o)) { /* conversion failed? */ |
| 355 | if (len != NULL) *len = 0; |
| 356 | lua_unlock(L); |
| 357 | return NULL; |
| 358 | } |
| 359 | luaC_checkGC(L); |
| 360 | o = index2adr(L, idx); /* previous call may reallocate the stack */ |
| 361 | lua_unlock(L); |
| 362 | } |
| 363 | if (len != NULL) *len = tsvalue(o)->len; |
| 364 | return svalue(o); |
| 365 | } |
| 366 | |
| 367 | |
| 368 | LUA_API size_t lua_objlen (lua_State *L, int idx) { |
no test coverage detected