Advertisement
Redxone

[ComputerCraft:Driver] - BunDrive

May 31st, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. function setColorOutput(s,c,o)
  2.    rs.setBundledOutput(s,c,o)
  3. end
  4. setBunOutput = rs.setBundledOutput
  5. function displaynum(side,num)
  6.   num = tostring(num)
  7.    local fn = string.sub(num,1,1)
  8.    local sn = nil
  9.      
  10.    if(#num > 1)then
  11.      sn = string.sub(num,1,1)
  12.      fn = string.sub(num,2,2)
  13.      sn = tonumber(sn)
  14.    end
  15.    fn = tonumber(fn)
  16.    
  17.    local nums = {
  18.     [0]="111111000",
  19.         "011000000",
  20.         "110110100",
  21.         "111100100",
  22.         "011001100",
  23.         "101101100",
  24.         "101111100",
  25.         "111000000",
  26.         "111111100",
  27.         "111001100",
  28.    }
  29.    local fullout = 0
  30.     if(sn ~= nil)then
  31.       for i = 1, #nums[sn] do
  32.         local setn = tonumber(string.sub(nums[sn],i,i))
  33.        if(setn == 1)then
  34.           fullout = fullout + 2^(i+7)
  35.        end
  36.       end
  37.     end
  38.     for i = 1, #nums[fn] do
  39.         local setn = tonumber(string.sub(nums[fn],i,i))
  40.        if(setn == 1)then
  41.           fullout = fullout + 2^(i-1)
  42.        end
  43.     end
  44.       setBunOutput(side,fullout)
  45. end
  46.  
  47. displaynum("back",36)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement