** 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'. */
| 588 | ** 'memcmp' and 'memcpy'. |
| 589 | */ |
| 590 | LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { |
| 591 | TString *ts; |
| 592 | lua_lock(L); |
| 593 | ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); |
| 594 | setsvalue2s(L, L->top.p, ts); |
| 595 | api_incr_top(L); |
| 596 | luaC_checkGC(L); |
| 597 | lua_unlock(L); |
| 598 | return getstr(ts); |
| 599 | } |
| 600 | |
| 601 | |
| 602 | LUA_API const char *lua_pushexternalstring (lua_State *L, |
no test coverage detected