Fix "searching" message to display before search begins
parent
f75eb607e1
commit
7454048aab
1
TODO.txt
1
TODO.txt
|
@ -1,3 +1,2 @@
|
|||
|
||||
TODO:
|
||||
- display "searching..." text before search begins, not after
|
||||
|
|
7
api.lua
7
api.lua
|
@ -200,13 +200,6 @@ local function formatMatching(player, nlist, params, switches, nocase)
|
|||
end
|
||||
end
|
||||
else
|
||||
-- FIXME: messages don't display until after list is loaded
|
||||
if deep_search then
|
||||
core.chat_send_player(player, "\n" .. S("Searching in names and descriptions ..."))
|
||||
else
|
||||
core.chat_send_player(player, "\n" .. S("Searching in names ..."))
|
||||
end
|
||||
|
||||
-- Fill matching list
|
||||
for i, item in ipairs(nlist) do
|
||||
local name = item.name
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
|
||||
v0.8
|
||||
----
|
||||
- fixed "searching" message to display before search begins
|
||||
|
||||
v0.7
|
||||
----
|
||||
- always register "mobs" type if mobs mod available
|
||||
|
|
21
chat.lua
21
chat.lua
|
@ -96,7 +96,26 @@ local function list(player, l_type, params)
|
|||
end
|
||||
end
|
||||
|
||||
return listitems.list(player, l_type, switches, params)
|
||||
local deep_search = true
|
||||
for _, sw in ipairs(switches) do
|
||||
if sw == "-s" then
|
||||
deep_search = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if deep_search then
|
||||
core.chat_send_player(player, "\n" .. S("Searching in names and descriptions ..."))
|
||||
else
|
||||
core.chat_send_player(player, "\n" .. S("Searching in names ..."))
|
||||
end
|
||||
|
||||
-- let "searching" messages display before executing search
|
||||
core.after(0, function()
|
||||
return listitems.list(player, l_type, switches, params)
|
||||
end)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue