Advertisement
Bolodefchoco_LUAXML

[Script] Colorful Table

Apr 23rd, 2017
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 23/04/2017
  3. --Last update: 23/04/2017
  4. --[[ Notes:
  5.     Does:
  6.         Cria tabelas de cores
  7.     Commands:
  8.         !Number x Number Space --> Primeiro número deverá ser as colunas e o segundo número deverá ser as linhas. Space pode ou não existir e é o espaço entre as textareas (padrão 20); Exemplo !4x4 e !4x4 25
  9. ]]--
  10.  
  11. local create
  12. start = {}
  13.  
  14. eventChatCommand = function(n,c)
  15.     local row,cel,space = c:match("(%d+) ?x ?(%d+)( %d*)$")
  16.     row,cel = tonumber(row) or 1,tonumber(cel) or 1
  17.     space = space and tonumber(space) or 20
  18.     if cel > 1 then
  19.         start = {row,cel,space}
  20.         create = coroutine.create(make)
  21.     end
  22. end
  23.  
  24. x,y = 5,30
  25. make = function(row,cel,space)
  26.     local id = 0
  27.     for i = 1,row do
  28.         local color = math.random(0xFFFFFF)
  29.         ui.addTextArea(id,"",nil,x,y,10,10,color,color,1,true)
  30.         for i = 1,cel do
  31.             local color = math.random(0xFFFFFF)
  32.             ui.addTextArea(-id,"",nil,x,y,10,10,-color,-color,1,true)
  33.             y = y + space
  34.             id = id + 1
  35.             if id % 5 == 0 then
  36.                 coroutine.yield()
  37.             end
  38.         end
  39.         y = 30
  40.         x = x + space
  41.         id = id + 1
  42.     end
  43.     x,y = 5,30
  44.     start = {}
  45. end
  46.  
  47. eventLoop = function()
  48.     if #start == 3 then
  49.         if coroutine.status(create) ~= "dead" then
  50.             coroutine.resume(create,start[1],start[2],start[3])
  51.         end
  52.     end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement