Advertisement
KananGamer

[TFM-LUA] UpdateTextArea Modified

Jul 26th, 2018
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. --[[
  2.     { UpdateTextAreaModified API } Created By: Nettoork#0000
  3.     - updateTextArea
  4.         id, modification, name
  5.         - modification
  6.             id, text, x, y, w, h, background, border, alpha, fixed
  7.     { EXAMPLES }
  8.         ui.addTextArea(1, '', nil, 5, 26, 100, 100, 1, 1, 1, true)
  9.         ui.updateTextArea(1, 'test1', nil)
  10.         ui.updateTextArea(1, 'test2')
  11.         ui.updateTextArea(1, {background = 0xFFFFFF}, nil)
  12. ]]--
  13.  
  14. do
  15.     local names, textAreas, addTextArea, removeTextArea, updateTextArea = {id = 1, text = 2, x = 4, y = 5, w = 6, h = 7, background = 8, border = 9, alpha = 10, fixed = 11}, {}, ui.addTextArea, ui.removeTextArea, ui.updateTextArea
  16.     ui.addTextArea = function(...)
  17.         local info = {...}
  18.         if not info[3] then info[3] = 'nil' end
  19.         textAreas[info[3]..'_'..info[1]] = {...}
  20.         addTextArea(...)
  21.     end
  22.     ui.updateTextArea = function(id, mod, name)
  23.         if not name then name = 'nil' end
  24.         if not textAreas[name..'_'..id] then return
  25.         elseif type(mod) == 'string' then
  26.             updateTextArea(id, mod, name)
  27.             textAreas[name..'_'..id][2] = mod
  28.             return
  29.         end
  30.         for i, v in next, mod do
  31.             if names[i] then
  32.                 textAreas[name..'_'..id][names[i]] = v
  33.                 local m = textAreas[name..'_'..id]
  34.                 addTextArea(m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11])
  35.             end
  36.         end
  37.     end
  38.     ui.removeTextArea = function(id, name)
  39.         if not name then name = 'nil' end
  40.         if textAreas[name..'_'..id] then textAreas[name..'_'..id] = nil end
  41.         removeTextArea(id, name)
  42.     end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement