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