** 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'. */
| 541 | ** 'memcmp' and 'memcpy'. |
| 542 | */ |
| 543 | LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { |
| 544 | TString *ts; |
| 545 | lua_lock(L); |
| 546 | ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); |
| 547 | setsvalue2s(L, L->top.p, ts); |
| 548 | api_incr_top(L); |
| 549 | luaC_checkGC(L); |
| 550 | lua_unlock(L); |
| 551 | return getstr(ts); |
| 552 | } |
| 553 | |
| 554 | |
| 555 | LUA_API const char *lua_pushexternalstring (lua_State *L, |
no test coverage detected