From 07fed9053a476b4c6e5ecd23fc43ec84f4094978 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sat, 13 Oct 2018 13:35:01 -0400 Subject: lua optimize current_path function frees up around 500 bytes by using the builtin string functionality Change-Id: Icd4ec921d3fec339b8a4b7f80c9c63d51d4c101c --- apps/plugins/lua/loadlib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apps/plugins/lua/loadlib.c') diff --git a/apps/plugins/lua/loadlib.c b/apps/plugins/lua/loadlib.c index 1cc7ebd..87873f1 100644 --- a/apps/plugins/lua/loadlib.c +++ b/apps/plugins/lua/loadlib.c @@ -54,7 +54,10 @@ static const char *pushnexttemplate (lua_State *L, const char *path) { static const char *findfile (lua_State *L, const char *name, const char *pname) { - const char *path, *current_path = get_current_path(L, 2); + get_current_path(L, 2); + const char *current_path = lua_tostring(L, -1); + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); lua_getfield(L, LUA_ENVIRONINDEX, pname); path = lua_tostring(L, -1); -- cgit v1.1