diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-05-11 21:35:41 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2021-05-19 23:28:35 +0000 |
commit | dcff9b85a3cef778af60ad4426f91262ba815931 (patch) | |
tree | 8f58cd59a2115ac70cd4df6e462ded09c81375fc /apps/plugins/lua/loadlib.c | |
parent | 0c6217757528b185c3f8628c062a2a688a8adaf8 (diff) | |
download | rockbox-dcff9b85a3cef778af60ad4426f91262ba815931.tar.gz rockbox-dcff9b85a3cef778af60ad4426f91262ba815931.zip |
lua latebound function update
return the nextfunction and nil instead of pairs it allows a faster
return to lua rather than calling the lua function
pcall(fnpairs) from c and returning the result back
into lua to kick off the search
yeah, no clue why I didn't realize that before..
testing in x86 and ARM..
its more RAM efficient to do the initial creation
of the stack in lua code for the __pairs functon
its not faster but being that its a one time hit per
iter creation the reduced churn alone should be worth it
along with a reduced peak RAM usage
fix bug where a failed module can not be reloaded
optimize filetol
fix potential bug in splash scroller when no break character is found
Change-Id: I42c922e07039a19138b97c0d0e80cf3cf2426471
Diffstat (limited to 'apps/plugins/lua/loadlib.c')
-rw-r--r-- | apps/plugins/lua/loadlib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/plugins/lua/loadlib.c b/apps/plugins/lua/loadlib.c index 1e310beed1..732ad707b5 100644 --- a/apps/plugins/lua/loadlib.c +++ b/apps/plugins/lua/loadlib.c | |||
@@ -130,9 +130,11 @@ static int ll_require (lua_State *L) { | |||
130 | lua_pushliteral(L, ""); /* error message accumulator */ | 130 | lua_pushliteral(L, ""); /* error message accumulator */ |
131 | for (i=1; ; i++) { | 131 | for (i=1; ; i++) { |
132 | lua_rawgeti(L, -2, i); /* get a loader */ | 132 | lua_rawgeti(L, -2, i); /* get a loader */ |
133 | if (lua_isnil(L, -1)) | 133 | if (lua_isnil(L, -1)) { |
134 | lua_setfield(L, 2, name); /* _LOADED[name] = nil */ | ||
134 | luaL_error(L, "module " LUA_QS " not found:%s", | 135 | luaL_error(L, "module " LUA_QS " not found:%s", |
135 | name, lua_tostring(L, -2)); | 136 | name, lua_tostring(L, -2)); |
137 | } | ||
136 | lua_pushstring(L, name); | 138 | lua_pushstring(L, name); |
137 | lua_call(L, 1, 1); /* call it */ | 139 | lua_call(L, 1, 1); /* call it */ |
138 | if (lua_isfunction(L, -1)) /* did it find module? */ | 140 | if (lua_isfunction(L, -1)) /* did it find module? */ |