Advertisement
jamawie

Jobcenter | Farben auslesen

Jun 5th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. str = "la<2>lal<4>ala<8>l<E>al<16>ala<32>lala"
  2. pos = 1
  3.  
  4. term.setTextColor(colors.white)
  5. abbruch = false
  6. while true do
  7.   stelleA = string.find(str,"<",pos)
  8.  
  9.   if stelleA == nil then
  10.     substr = string.sub(str,pos)
  11.   else
  12.     substr = string.sub(str,pos,stelleA-1)
  13.   end
  14.   term.write(substr)
  15.  
  16.  
  17.   if abbruch==true then
  18.     break
  19.   end
  20.  
  21.  
  22.   stelleE = string.find(str,">",pos)
  23.  
  24.   if stelleE then
  25.     col = string.sub(str,stelleA+1,stelleE-1)
  26.   else
  27.     abbruch = true
  28.   end
  29.  
  30.   if not string.match(col,"[a-zA-Z]+") then
  31.     term.setTextColor(tonumber(col))
  32.   elseif col == "E" then
  33.     print("")
  34.   end
  35.  
  36.   if stelleE then
  37.     pos = stelleE+1
  38.   end
  39.  
  40.   sleep(0.1)
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement