aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lapi.c b/lapi.c
index 7a91185a..0ed2734d 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.118 2010/03/29 17:43:14 roberto Exp roberto $ 2** $Id: lapi.c,v 2.119 2010/04/02 15:19:19 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -442,8 +442,16 @@ LUA_API const char *lua_pushstring (lua_State *L, const char *s) {
442 lua_pushnil(L); 442 lua_pushnil(L);
443 return NULL; 443 return NULL;
444 } 444 }
445 else 445 else {
446 return lua_pushlstring(L, s, strlen(s)); 446 TString *ts;
447 lua_lock(L);
448 luaC_checkGC(L);
449 ts = luaS_new(L, s);
450 setsvalue2s(L, L->top, ts);
451 api_incr_top(L);
452 lua_unlock(L);
453 return getstr(ts);
454 }
447} 455}
448 456
449 457