mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[lua] foreachi replaced by ipairs. Refs #46
This commit is contained in:
parent
9e71d7f3c8
commit
b3ae1caf8b
@ -69,10 +69,10 @@ end
|
|||||||
function bm_sort_bookmarks ()
|
function bm_sort_bookmarks ()
|
||||||
if not bm_auto_sort_bookmarks then return end
|
if not bm_auto_sort_bookmarks then return end
|
||||||
table.sort (bm_bookmarks, function (a, b) return a.category < b.category end)
|
table.sort (bm_bookmarks, function (a, b) return a.category < b.category end)
|
||||||
foreachi (bm_bookmarks,
|
for i,v in ipairs(bm_bookmarks)
|
||||||
function (i, v)
|
do
|
||||||
table.sort (v, function (a, b) return a.name < b. name end)
|
table.sort (v, function (a, b) return a.name < b. name end)
|
||||||
end)
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,48 +81,47 @@ pre_format_html_hooks = {n=0}
|
|||||||
function pre_format_html_hook (url, html)
|
function pre_format_html_hook (url, html)
|
||||||
local changed = nil
|
local changed = nil
|
||||||
|
|
||||||
table.foreachi(pre_format_html_hooks,
|
for i,fn in ipairs(pre_format_html_hooks)
|
||||||
function (i, fn)
|
do
|
||||||
local new,stop = fn(url,html)
|
local new,stop = fn(url,html)
|
||||||
|
|
||||||
if new then html=new changed=1 end
|
if new then html=new changed=1 end
|
||||||
return stop
|
end
|
||||||
end)
|
|
||||||
|
|
||||||
return changed and html
|
return changed and html
|
||||||
end
|
end
|
||||||
|
|
||||||
goto_url_hooks = {n=0}
|
goto_url_hooks = {n=0}
|
||||||
function goto_url_hook (url, current_url)
|
function goto_url_hook (url, current_url)
|
||||||
table.foreachi(goto_url_hooks,
|
for i,fn in ipairs(goto_url_hooks)
|
||||||
function (i, fn)
|
do
|
||||||
local new,stop = fn(url, current_url)
|
local new,stop = fn(url, current_url)
|
||||||
|
|
||||||
url = new
|
url = new
|
||||||
|
end
|
||||||
|
|
||||||
return stop
|
return url
|
||||||
end)
|
|
||||||
|
|
||||||
return url
|
|
||||||
end
|
end
|
||||||
|
|
||||||
follow_url_hooks = {n=0}
|
follow_url_hooks = {n=0}
|
||||||
function follow_url_hook (url)
|
function follow_url_hook (url)
|
||||||
table.foreachi(follow_url_hooks,
|
for i,fn in ipairs(follow_url_hooks)
|
||||||
function (i, fn)
|
do
|
||||||
local new,stop = fn(url)
|
local new,stop = fn(url)
|
||||||
|
|
||||||
url = new
|
url = new
|
||||||
|
|
||||||
return stop
|
end
|
||||||
end)
|
|
||||||
|
|
||||||
return url
|
return url
|
||||||
end
|
end
|
||||||
|
|
||||||
quit_hooks = {n=0}
|
quit_hooks = {n=0}
|
||||||
function quit_hook (url, html)
|
function quit_hook (url, html)
|
||||||
table.foreachi(quit_hooks, function (i, fn) return fn() end)
|
for i, fn in ipairs(quit_hooks)
|
||||||
|
do
|
||||||
|
fn()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user