From 14e416355f83cf0a1b871eedec2c92b86dbe76d6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 5 Sep 2023 15:30:45 -0300 Subject: Added suport for Fixed Buffers A fixed buffer keeps a binary chunk "forever", so that the program does not need to copy some of its parts when loading it. --- ltests.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index e218778a..15d1a564 100644 --- a/ltests.c +++ b/ltests.c @@ -1513,8 +1513,11 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { luaL_loadfile(L1, luaL_checkstring(L1, getnum)); } else if EQ("loadstring") { - const char *s = luaL_checkstring(L1, getnum); - luaL_loadstring(L1, s); + size_t slen; + const char *s = luaL_checklstring(L1, getnum, &slen); + const char *name = getstring; + const char *mode = getstring; + luaL_loadbufferx(L1, s, slen, name, mode); } else if EQ("newmetatable") { lua_pushboolean(L1, luaL_newmetatable(L1, getstring)); -- cgit v1.2.3-55-g6feb