Lupino

make_craft_table.lua

Jul 14th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.61 KB | None | 0 0
  1. local component = require("component")
  2. local db = component.database
  3.  
  4. function getDbItemName(slot)
  5.     local item = db.get(slot)
  6.     if item then
  7.         return item.name
  8.     else
  9.         return ''
  10.     end
  11. end
  12.  
  13. function makeCraftTable(offset)
  14.     local target = getDbItemName(10 + offset)
  15.  
  16.     local craftTable = {}
  17.     local slot
  18.     for slot = 1, 9, 1 do
  19.         craftTable[slot] = getDbItemName(slot + offset)
  20.     end
  21.     print('craftTables["' .. target .. '"] = {"' .. table.concat(craftTable, '", "') .. '"}')
  22. end
  23.  
  24. function main()
  25.     makeCraftTable(0)
  26.     makeCraftTable(10)
  27. end
  28.  
  29. main()
Add Comment
Please, Sign In to add comment