From 5d200154e84c0b57723fd6ed3eadd1a84674f855 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 22 Feb 2026 14:01:27 +0100 Subject: [PATCH] lua_pushlstring: prefer luaS_newlstr over luaS_new the latter calls strlen which is not needed as the empty string has no length --- src/blua/lapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blua/lapi.c b/src/blua/lapi.c index 557896f43..6a33983fe 100644 --- a/src/blua/lapi.c +++ b/src/blua/lapi.c @@ -434,7 +434,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { lua_lock(L); luaC_checkGC(L); - setsvalue2s(L, L->top, (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len)); + setsvalue2s(L, L->top, (len == 0) ? luaS_newlstr(L, "", 0) : luaS_newlstr(L, s, len)); api_incr_top(L); lua_unlock(L); }