| 615 | |
| 616 | |
| 617 | LUA_API const char *lua_pushstring (lua_State *L, const char *s) { |
| 618 | lua_lock(L); |
| 619 | if (s == NULL) |
| 620 | setnilvalue(s2v(L->top.p)); |
| 621 | else { |
| 622 | TString *ts; |
| 623 | ts = luaS_new(L, s); |
| 624 | setsvalue2s(L, L->top.p, ts); |
| 625 | s = getstr(ts); /* internal copy's address */ |
| 626 | } |
| 627 | api_incr_top(L); |
| 628 | luaC_checkGC(L); |
| 629 | lua_unlock(L); |
| 630 | return s; |
| 631 | } |
| 632 | |
| 633 | PLUTO_API const char* pluto_pushstring(lua_State* L, const std::string& str) { |
| 634 | return lua_pushlstring(L, str.c_str(), str.length()); |
no test coverage detected