aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lapi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lapi.c b/lapi.c
index 80e89f12..bd4efaa3 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.252 2015/08/03 19:50:49 roberto Exp roberto $ 2** $Id: lapi.c,v 2.253 2015/08/03 20:40:26 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*/
@@ -471,10 +471,15 @@ LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
471} 471}
472 472
473 473
474/*
475** Pushes on the stack a string with given length. Even when 'len' == 0,
476** 's' cannot be NULL due to later use of 'memcmp' and 'memcpy'.
477*/
474LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { 478LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) {
475 TString *ts; 479 TString *ts;
476 lua_lock(L); 480 lua_lock(L);
477 luaC_checkGC(L); 481 luaC_checkGC(L);
482 api_check(L, s != NULL, "pointer cannot be NULL");
478 ts = luaS_newlstr(L, s, len); 483 ts = luaS_newlstr(L, s, len);
479 setsvalue2s(L, L->top, ts); 484 setsvalue2s(L, L->top, ts);
480 api_incr_top(L); 485 api_incr_top(L);