diff options
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 14 |
1 files changed, 14 insertions, 0 deletions
| @@ -535,6 +535,20 @@ LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { | |||
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | 537 | ||
| 538 | LUA_API const char *lua_pushextlstring (lua_State *L, | ||
| 539 | const char *s, size_t len, lua_Alloc falloc, void *ud) { | ||
| 540 | TString *ts; | ||
| 541 | lua_lock(L); | ||
| 542 | api_check(L, s[len] == '\0', "string not ending with zero"); | ||
| 543 | ts = luaS_newextlstr (L, s, len, falloc, ud); | ||
| 544 | setsvalue2s(L, L->top.p, ts); | ||
| 545 | api_incr_top(L); | ||
| 546 | luaC_checkGC(L); | ||
| 547 | lua_unlock(L); | ||
| 548 | return getstr(ts); | ||
| 549 | } | ||
| 550 | |||
| 551 | |||
| 538 | LUA_API const char *lua_pushstring (lua_State *L, const char *s) { | 552 | LUA_API const char *lua_pushstring (lua_State *L, const char *s) { |
| 539 | lua_lock(L); | 553 | lua_lock(L); |
| 540 | if (s == NULL) | 554 | if (s == NULL) |
