Skip to content

Instantly share code, notes, and snippets.

@zigdon
Created October 24, 2020 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zigdon/5fd90dada4ff9d67251eb8d34fb6505b to your computer and use it in GitHub Desktop.
Save zigdon/5fd90dada4ff9d67251eb8d34fb6505b to your computer and use it in GitHub Desktop.
me = components.me_interface
craftables = me.getCraftables()
print("Found " .. craftables.n .. " patterns.")
matches = {}
for word in arg do
for k, v in pairs(craftables) do
info = v.getItemStack()
label = info.label
name = info.name
if string.find(info .. "/" .. name, word) then
table.insert(matches, info)
end
end
craftables = matches
end
print("Found " .. matches.n .. " matches.")
for k, v in pairs(matches) do
info = v.getItemStack()
print(info.label .. ": " .. info.name)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment