From c6fcb1cf45b249b059c2d53a062f9a6c7f449047 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 11 Nov 2018 18:27:19 -0500 Subject: lua inbinary strings Allows saving of ram by reusing strings already stored in the binary and storing a pointer instead of malloc and copy to get them inside the lua state Saves about 1.5K overall Derivative of work by bogdanm RAM optimizations: pseudo RO strings, functions in Flash https://github.com/elua/elua/commit/d54659b5723bcd2b1e3900362398c72c18a9aa0b Change-Id: I21d6dcfa32523877efd9f70fb0f88f2a02872649 --- apps/plugins/lua/ltm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'apps/plugins/lua/ltm.c') diff --git a/apps/plugins/lua/ltm.c b/apps/plugins/lua/ltm.c index c27f0f6fab..946028006f 100644 --- a/apps/plugins/lua/ltm.c +++ b/apps/plugins/lua/ltm.c @@ -36,10 +36,8 @@ void luaT_init (lua_State *L) { "__concat", "__call" }; int i; - for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); - luaS_fix(G(L)->tmname[i]); /* never collect these names */ - } + for (i=0; itmname[i] = luaS_newlloc(L, luaT_eventname[i], TSTR_INBIN | TSTR_FIXED); } -- cgit v1.2.3