Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local printer = peripheral.find("printer")
- local w, h = 25, 21
- local BARCODE_START = 128
- local BARCODE_CHARS = 32
- local function generateBarcode()
- local out = ""
- for y = 1, 4 do
- for x = 1, w do
- out = out .. string.char(math.random(BARCODE_START, BARCODE_START + BARCODE_CHARS))
- end
- end
- return out
- end
- local function printBarcode(barcode)
- local lines = math.ceil(#barcode / w)
- for y = 1, h + 2 do
- --local line = barcode:sub(y * w, math.min((y + 1) * w, #barcode))
- local line = ("A"):rep(w)
- -- printer.setCursorPos(1, (h - lines) + y)
- printer.setCursorPos(1, y)
- printer.write(line)
- end
- end
- printer.newPage()
- --local barcode = generateBarcode()
- --printBarcode(barcode)
- for i = 1, 30 do
- printer.setCursorPos(1, i)
- printer.write(i)
- end
- printer.endPage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement