Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("left") -- Wrap the modem connected to the left side
- modem.open(1) -- Open channel 1 for communication
- -- Your logic for generating the list of missing items
- local allItems = {"Apples", "Bananas", "Oranges", "Grapes"} -- Example full list
- local availableItems = {"Apples", "Grapes"} -- Example of what's already available
- -- Function to determine missing items
- local function getMissingItems(all, available)
- local missing = {}
- for _, item in ipairs(all) do
- local found = false
- for _, availableItem in ipairs(available) do
- if item == availableItem then
- found = true
- break
- end
- end
- if not found then
- table.insert(missing, item)
- end
- end
- return missing
- end
- -- Generate the list of missing items
- local missingItems = getMissingItems(allItems, availableItems)
- -- Send the list wirelessly to the monitor on channel 1
- modem.transmit(1, 1, missingItems)
- print("Missing items sent wirelessly!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement