** Pushes on the stack a string with given length. Avoid using 's' when ** 'len' == 0 (as 's' can be nullptr in that case), due to later use of ** 'memcmp' and 'memcpy'. */
| 480 | ** 'memcmp' and 'memcpy'. |
| 481 | */ |
| 482 | LUA_API const char *lua_pushlstring(lua_State *L, const char *s, size_t len) { |
| 483 | TString *ts; |
| 484 | lua_lock(L); |
| 485 | luaC_checkGC(L); |
| 486 | ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); |
| 487 | setsvalue2s(L, L->top, ts); |
| 488 | api_incr_top(L); |
| 489 | lua_unlock(L); |
| 490 | return getstr(ts); |
| 491 | } |
| 492 | |
| 493 | |
| 494 | LUA_API const char *lua_pushstring(lua_State *L, const char *s) { |
no test coverage detected