]> git.lizzy.rs Git - xdecor.git/commitdiff
Only Pickaxe is repairable.
authorAuke Kok <sofar@foo-projects.org>
Wed, 8 Feb 2017 03:49:45 +0000 (19:49 -0800)
committerAuke Kok <sofar@foo-projects.org>
Wed, 8 Feb 2017 04:07:51 +0000 (20:07 -0800)
Luacheck points out that:

```
Checking src/workbench.lua                        1 warning
    src/workbench.lua:74:2: loop is executed at most once
```

And this is correct, only the pickaxe is actually currently
repairable.

Returned the code to the previous (working) fashion.

src/workbench.lua

index 79ba691f722eb9efe55ae66c29eae0209f3bdeab..41c797d1eeb47e3e958a6400296307f86d96bcf6 100644 (file)
@@ -71,9 +71,10 @@ workbench.defs = {
 -- Tools allowed to be repaired
 function workbench:repairable(stack)
        local tools = {"pick", "axe", "shovel", "sword", "hoe", "armor", "shield"}
-       for i=1, #tools do
-               return stack:find(tools[i])
+       for _, t in pairs(tools) do
+               if stack:find(t) then return true end
        end
+       return false
 end
 
 function workbench:get_output(inv, input, name)