diff options
author | Jean-Patrick Guerrero <jeanpatrick.guerrero@gmail.com> | 2016-02-22 14:11:54 +0100 |
---|---|---|
committer | Jean-Patrick Guerrero <jeanpatrick.guerrero@gmail.com> | 2016-02-22 14:11:54 +0100 |
commit | 3285ea6ec0e891f306238efc693528e32a969d23 (patch) | |
tree | 03822d73eb2fcf11ea93db7b13b348cf592e85ae /init.lua | |
parent | 490481600042175c0480a7b822e188584c8ff9d0 (diff) |
Small localization and pattern simplifying
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -117,13 +117,14 @@ minetest.register_on_player_receive_fields(function(player, listname, fields) craftguide:get_items(nil, player_name) craftguide:get_formspec(stack, 1, nil, 1, "", player_name) elseif fields.alternate then - local item = formspec:match("item_image_button%[.*;([%w_:]+);.*%]") or 1 + local item = formspec:match("item_image_button%[.*;([%w_:]+);") or 1 local recipe_num = tonumber(formspec:match("Recipe%s(%d+)")) or 1 recipe_num = recipe_num + 1 craftguide:get_formspec(stack, pagenum, item, recipe_num, filter, player_name) elseif fields.search then - craftguide:get_items(fields.filter:lower(), player_name) - craftguide:get_formspec(stack, 1, nil, 1, fields.filter:lower(), player_name) + local lowstr = fields.filter:lower() + craftguide:get_items(lowstr, player_name) + craftguide:get_formspec(stack, 1, nil, 1, lowstr, player_name) elseif fields.prev or fields.next then if fields.prev then pagenum = pagenum - 1 else pagenum = pagenum + 1 end |