Advertisement
KananGamer

[TFM-LUA] Require 1.2.2

Dec 5th, 2018
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.34 KB | None | 0 0
  1. --[[
  2.     Author(s): Nettoork#0000
  3. ]]--
  4.  
  5. do
  6.     --- Variáveis de bibliotecas ---
  7.     local coroutines    = {}
  8.     local textAreas     = {}
  9.     local db            = {}
  10.     local wait          = {}
  11.     local libs
  12.     --------------------------------
  13.     libs = {
  14.         ['perfomance'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.0', dependencies = {},
  15.             ['create'] = function (average, loops, func)
  16.                 local times = 0
  17.                 for v = 1, average do
  18.                     local ms = os.time()
  19.                     for i = 1, loops do
  20.                         func(loops)
  21.                     end
  22.                     times = times + os.time() - ms
  23.                 end
  24.                 return('Estimated Time: '..times/average..' ms.')
  25.             end
  26.         },
  27.         ['button'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.0', dependencies = {},
  28.             ['create'] = function(...)
  29.                 local arg = {...}
  30.                 local id = -543212345+arg[1]*3
  31.                 local color = arg[9] and '0x2A424B' or '0x314e57'
  32.                 ui.addTextArea(id, '', arg[4], arg[5]-1, arg[6]-1, arg[7], arg[8], 0x7a8d93, 0x7a8d93, 1, true)
  33.                 ui.addTextArea(id-1, '', arg[4], arg[5]+1, arg[6]+1, arg[7], arg[8], 0x0e1619, 0x0e1619, 1, true)
  34.                 ui.addTextArea(id-2, '<p align="center"><a href="event:'..arg[3]..'">'..arg[2]..'</a></p>', arg[4], arg[5], arg[6] , arg[7], arg[8], color, color, 1, true)
  35.             end,
  36.             ['remove'] = function(id, name)
  37.                 for i = 0, 2 do
  38.                     ui.removeTextArea(-543212345+id*3-i, name)
  39.                 end
  40.             end
  41.         },
  42.         ['ui-design'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.0', dependencies = {},
  43.             ['create'] = function(...)
  44.                 local arg = {...}
  45.                 if arg[6] < 0 or arg[7] and arg[7] < 0 then
  46.                     return
  47.                 elseif not arg[7] then
  48.                     arg[7] = arg[6]/2
  49.                 end
  50.                 local id = 543212345+arg[1]*8
  51.                 ui.addTextArea(id, '', arg[3], arg[4], arg[5], arg[6]+100, arg[7]+70, 0x78462b, 0x78462b, 1, true)
  52.                 ui.addTextArea(id+1, '', arg[3], arg[4], arg[5]+(arg[7]+140)/4, arg[6]+100, arg[7]/2, 0x9d7043, 0x9d7043, 1, true)
  53.                 ui.addTextArea(id+2, '', arg[3], arg[4]+(arg[6]+180)/4, arg[5], (arg[6]+10)/2, arg[7]+70, 0x9d7043, 0x9d7043, 1, true)
  54.                 ui.addTextArea(id+3, '', arg[3], arg[4], arg[5], 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  55.                 ui.addTextArea(id+4, '', arg[3], arg[4]+arg[6]+80, arg[5], 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  56.                 ui.addTextArea(id+5, '', arg[3], arg[4], arg[5]+arg[7]+50, 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  57.                 ui.addTextArea(id+6, '', arg[3], arg[4]+arg[6]+80, arg[5]+arg[7]+50, 20, 20, 0xbeb17d, 0xbeb17d, 1, true)
  58.                 ui.addTextArea(id+7, arg[2], arg[3], arg[4]+3, arg[5]+3, arg[6]+94, arg[7]+64, 0x1c3a3e, 0x232a35, 1, true)
  59.             end,
  60.             ['remove'] = function(id, name)
  61.                 for i = 0, 7 do
  62.                     ui.removeTextArea(543212345+id*8+i, name)
  63.                 end
  64.             end
  65.         },
  66.         ['text-area-custom'] = { AUTHOR = 'Nettoork#0000', _VERSION = '2.0', dependencies = {},
  67.             ['add'] = function(...)
  68.                 local info = {...}
  69.                 if type(info[1]) == 'table' then
  70.                     for i, v in next, info do
  71.                         if type(v) == 'table' then
  72.                             if not v[3] then
  73.                                 v[3] = 'nil'
  74.                             end
  75.                             addTextArea(table.unpack(v))
  76.                         end
  77.                     end
  78.                 else
  79.                     if not info[3] then
  80.                         info[3] = 'nil'
  81.                     end
  82.                     textAreas[info[3]..'_'..info[1]] = {...}
  83.                     ui.addTextArea(...)
  84.                 end
  85.             end,
  86.             ['update'] = function(id, mod, name)
  87.                 if not name then
  88.                     name = 'nil'
  89.                 end
  90.                 if not textAreas[name..'_'..id] then
  91.                     return
  92.                 elseif type(mod) == 'string' then
  93.                     ui.updateTextArea(id, mod, name)
  94.                     textAreas[name..'_'..id][2] = mod
  95.                     return
  96.                 end
  97.                 local names = {text = 2, x = 4, y = 5, w = 6, h = 7, background = 8, border = 9, alpha = 10, fixed = 11}
  98.                 for i, v in next, mod do
  99.                     if names[i] then
  100.                         textAreas[name..'_'..id][names[i]] = v
  101.                     end
  102.                 end
  103.                 local m = textAreas[name..'_'..id]
  104.                 ui.addTextArea(m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11])
  105.             end,
  106.             ['remove'] = function(id, name)
  107.                 if not name then
  108.                     name = 'nil'
  109.                 end
  110.                 if textAreas[name..'_'..id] then
  111.                     textAreas[name..'_'..id] = nil
  112.                 end
  113.                 ui.removeTextArea(id, name)
  114.             end
  115.         },
  116.         ['string-to-boolean'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.0', dependencies = {},
  117.             ['parse'] = function(tableC)
  118.                 local finalTable = {}
  119.                 for i, v in next, tableC do
  120.                     finalTable[v] = true
  121.                 end
  122.                 return finalTable
  123.             end
  124.         },
  125.         ['database'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.1', dependencies = {},
  126.             ['create'] = function(username, tab)
  127.                 if not db[username] then
  128.                     db[username] = tab
  129.                 end
  130.             end,
  131.             ['delete'] = function(username)
  132.                 db[username] = nil
  133.             end,
  134.             ['get'] = function(username, ...)
  135.                 local ret, args = {}, {...}
  136.                 if not args[1] then
  137.                     return db[username]
  138.                 else
  139.                     for i, v in next, args do
  140.                         if db[username][v] then
  141.                             ret[#ret + 1] = db[username][v]
  142.                         end
  143.                     end
  144.                     return table.unpack(ret)
  145.                 end
  146.             end,
  147.             ['set'] = function(username, ...)
  148.                 local add = v
  149.                 for i, v in next, {...} do
  150.                     if not add then
  151.                         add = v
  152.                     else
  153.                         db[username][add] = v
  154.                         add = false
  155.                     end
  156.                 end
  157.             end
  158.         },
  159.         ['encryption'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.0', dependencies = {},
  160.             ['encrypt'] = function(tableC, password, password2)
  161.                 if not tableC or not password or not password2 or type(tableC) ~= 'table' or password == '' or password2 == '' then return end
  162.                 local initSeed, finalString, newMessage, key = '', '', '', ''
  163.                 for i in password:gmatch('.') do
  164.                     initSeed = initSeed..i:byte()
  165.                 end
  166.                 for i in password2:gmatch('.') do
  167.                     key = key..i:byte()
  168.                 end
  169.                 math.randomseed(initSeed)
  170.                 otherSeed = math.random(1000000)
  171.                 local action = pcall(function()
  172.                     for i, v in next, tableC do
  173.                         if type(v) == 'string' or type(v) == 'number' then
  174.                             if type(v) == 'string' then
  175.                                 v = "'"..v.."'"
  176.                             end
  177.                             newMessage = newMessage..' '..v..' '..i:upper()
  178.                         else
  179.                             return
  180.                         end
  181.                     end
  182.                     newMessage = newMessage..' '..key
  183.                     for i in newMessage:gmatch('.') do
  184.                         local newByte = i:byte() + 68 + math.random(5)
  185.                         otherSeed = otherSeed + i:byte()
  186.                         math.randomseed(otherSeed)
  187.                         if (newByte >= 65 and newByte <= 122) and not (newByte >= 91 and newByte <= 96) then
  188.                             newByte = string.char(newByte)
  189.                         end
  190.                         finalString = finalString..newByte
  191.                     end
  192.                 end)
  193.                 math.randomseed(os.time())
  194.                 if not action then
  195.                     return
  196.                 else
  197.                     return finalString
  198.                 end
  199.             end,
  200.             ['decrypt'] = function(stringC, password, password2)
  201.                 if not stringC or not password or not password2 or type(stringC) ~= 'string' or password == '' or password2 == '' then return end
  202.                 local initSeed, finalString, aByte, key = '', '', '', ''
  203.                 for i in password:gmatch('.') do
  204.                     initSeed = initSeed..i:byte()
  205.                 end
  206.                 for i in password2:gmatch('.') do
  207.                     key = key..i:byte()
  208.                 end
  209.                 math.randomseed(initSeed)
  210.                 otherSeed = math.random(1000000)
  211.                 local action = pcall(function()
  212.                     for i in stringC:gmatch('.') do
  213.                         if i:byte() >= 65 and i:byte() <= 122 then
  214.                             local newByte = i:byte() - 68 - math.random(5)
  215.                             otherSeed = otherSeed + newByte
  216.                             math.randomseed(otherSeed)
  217.                             finalString = finalString..string.char(newByte)
  218.                         else
  219.                             aByte = aByte..i
  220.                             if aByte:len() >= 3 then
  221.                                 local newByte = tonumber(aByte) - 68 - math.random(5)
  222.                                 otherSeed = otherSeed + newByte
  223.                                 math.randomseed(otherSeed)
  224.                                 finalString = finalString..string.char(newByte)
  225.                                 aByte = ''
  226.                             end
  227.                         end
  228.                     end
  229.                 end)
  230.                 math.randomseed(os.time())
  231.                 if not action then
  232.                     return
  233.                 else
  234.                     local finalTable, stage, fsLength, aString, aNumber = {}, 0, 0
  235.                     for i, v in string.gmatch(finalString, '[^%s]+') do
  236.                         fsLength = fsLength + 1
  237.                     end
  238.                     for i, v in string.gmatch(finalString, '[^%s]+') do
  239.                         stage = stage + 1
  240.                         if stage == fsLength and i ~= key then
  241.                             return
  242.                         elseif aString then
  243.                             if aString:sub(-1) == "'" then
  244.                                 finalTable[i:lower()] = aString:gsub("'", '')
  245.                                 aString = nil
  246.                             else
  247.                                 aString = aString..' '..i
  248.                             end
  249.                         elseif aNumber then
  250.                             finalTable[i:lower()] = aNumber
  251.                             aNumber = nil
  252.                         elseif i:sub(1, 1) == "'" then
  253.                             aString = i
  254.                         else
  255.                             aNumber = i
  256.                         end
  257.                     end
  258.                     return finalTable
  259.                 end
  260.             end
  261.         },
  262.         ['sleep'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.1', dependencies = {},
  263.             ['loop'] = function()
  264.                 local toRemove = {}
  265.                 for i, v in next, coroutines do
  266.                     if not v[2] or v[2] < os.time() then
  267.                         if (coroutine.status(v[1]) == 'dead') then
  268.                             toRemove[#toRemove+1] = i
  269.                         else
  270.                             local s, timerV = coroutine.resume(v[1])
  271.                             v[2] = timerV
  272.                         end
  273.                     end
  274.                 end
  275.                 if (toRemove[1]) then
  276.                     for i, v in next, toRemove do
  277.                         coroutines[v] = nil
  278.                     end
  279.                 end
  280.             end,
  281.             ['run'] = function(f, checkTimer)
  282.                 if not checkTimer then checkTimer = 500 end
  283.                 coroutines[#coroutines + 1] = {coroutine.create(function()
  284.                     local pause = function(n)
  285.                         coroutine.yield(os.time() + math.floor(n/checkTimer)*checkTimer)
  286.                     end
  287.                     f(pause)
  288.                 end), timeValue = nil}
  289.             end
  290.         },
  291.         ['wait-time'] = { AUTHOR = 'Nettoork#0000', _VERSION = '1.0', dependencies = {},
  292.             ['check'] = function(section, subsection, delay, start)
  293.                 if section and subsection then
  294.                     if not wait[section] then wait[section] = {} end
  295.                     if not wait[section][subsection] then start = 0 wait[section][subsection] = os.time() + (delay or 1000) end
  296.                     if wait[section][subsection] <= os.time() or start and start == 0 then
  297.                         wait[section][subsection] = os.time() + (delay or 1000)
  298.                         return true
  299.                     else
  300.                         return false
  301.                     end
  302.                 end
  303.                
  304.             end
  305.         },
  306.         ['json'] = { AUTHOR = 'https://github.com/rxi', _VERSION = '0.1.1', dependencies = {},
  307.             ['encode'] = function(val)
  308.                 local encode
  309.                 local escape_char_map = {
  310.                     [ "\\" ] = "\\\\",
  311.                     [ "\"" ] = "\\\"",
  312.                     [ "\b" ] = "\\b",
  313.                     [ "\f" ] = "\\f",
  314.                     [ "\n" ] = "\\n",
  315.                     [ "\r" ] = "\\r",
  316.                     [ "\t" ] = "\\t",
  317.                 }
  318.                 local escape_char_map_inv = { [ "\\/" ] = "/" }
  319.                 for k, v in pairs(escape_char_map) do
  320.                     escape_char_map_inv[v] = k
  321.                 end
  322.                 local function escape_char(c)
  323.                     return escape_char_map[c] or string.format("\\u%04x", c:byte())
  324.                 end
  325.                 local function encode_nil(val)
  326.                     return "null"
  327.                 end
  328.                 local function encode_table(val, stack)
  329.                 local res = {}
  330.                 stack = stack or {}
  331.                 if stack[val] then error("circular reference") end
  332.                 stack[val] = true
  333.                 if val[1] ~= nil or next(val) == nil then
  334.                     local n = 0
  335.                     for k in pairs(val) do
  336.                         if type(k) ~= "number" then
  337.                             error("invalid table: mixed or invalid key types")
  338.                         end
  339.                         n = n + 1
  340.                     end
  341.                     if n ~= #val then
  342.                         error("invalid table: sparse array")
  343.                     end
  344.                     for i, v in ipairs(val) do
  345.                         table.insert(res, encode(v, stack))
  346.                     end
  347.                     stack[val] = nil
  348.                     return "[" .. table.concat(res, ",") .. "]"
  349.                 else
  350.                     for k, v in pairs(val) do
  351.                         if type(k) ~= "string" then
  352.                             error("invalid table: mixed or invalid key types")
  353.                         end
  354.                             table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
  355.                         end
  356.                         stack[val] = nil
  357.                         return "{" .. table.concat(res, ",") .. "}"
  358.                     end
  359.                 end
  360.                 local function encode_string(val)
  361.                     return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
  362.                 end
  363.                 local function encode_number(val)
  364.                     if val ~= val or val <= -math.huge or val >= math.huge then
  365.                         error("unexpected number value '" .. tostring(val) .. "'")
  366.                     end
  367.                     return val
  368.                 end
  369.                 local type_func_map = {
  370.                 [ "nil"     ] = encode_nil,
  371.                 [ "table"   ] = encode_table,
  372.                 [ "string"  ] = encode_string,
  373.                 [ "number"  ] = encode_number,
  374.                 [ "boolean" ] = tostring,
  375.                 }
  376.                 encode = function(val, stack)
  377.                     local t = type(val)
  378.                     local f = type_func_map[t]
  379.                     if f then
  380.                         return f(val, stack)
  381.                     end
  382.                     error("unexpected type '" .. t .. "'")
  383.                 end
  384.                 return encode(val)
  385.             end,
  386.             ['decode'] = function(str)
  387.                 local parse
  388.                 local escape_char_map_inv = { [ "\\/" ] = "/" }
  389.                 local function create_set(...)
  390.                   local res = {}
  391.                   for i = 1, select("#", ...) do
  392.                     res[ select(i, ...) ] = true
  393.                   end
  394.                   return res
  395.                 end
  396.                 local space_chars   = create_set(" ", "\t", "\r", "\n")
  397.                 local delim_chars   = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
  398.                 local escape_chars  = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
  399.                 local literals      = create_set("true", "false", "null")
  400.                 local literal_map = {
  401.                   [ "true"  ] = true,
  402.                   [ "false" ] = false,
  403.                   [ "null"  ] = nil,
  404.                 }
  405.                 local function next_char(str, idx, set, negate)
  406.                   for i = idx, #str do
  407.                     if set[str:sub(i, i)] ~= negate then
  408.                       return i
  409.                     end
  410.                   end
  411.                   return #str + 1
  412.                 end
  413.                 local function decode_error(str, idx, msg)
  414.                   local line_count = 1
  415.                   local col_count = 1
  416.                   for i = 1, idx - 1 do
  417.                     col_count = col_count + 1
  418.                     if str:sub(i, i) == "\n" then
  419.                       line_count = line_count + 1
  420.                       col_count = 1
  421.                     end
  422.                   end
  423.                   error( string.format("%s at line %d col %d", msg, line_count, col_count) )
  424.                 end
  425.                 local function codepoint_to_utf8(n)
  426.                   local f = math.floor
  427.                   if n <= 0x7f then
  428.                     return string.char(n)
  429.                   elseif n <= 0x7ff then
  430.                     return string.char(f(n / 64) + 192, n % 64 + 128)
  431.                   elseif n <= 0xffff then
  432.                     return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
  433.                   elseif n <= 0x10ffff then
  434.                     return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
  435.                                        f(n % 4096 / 64) + 128, n % 64 + 128)
  436.                   end
  437.                   error( string.format("invalid unicode codepoint '%x'", n) )
  438.                 end
  439.                 local function parse_unicode_escape(s)
  440.                   local n1 = tonumber( s:sub(3, 6),  16 )
  441.                   local n2 = tonumber( s:sub(9, 12), 16 )
  442.                   if n2 then
  443.                     return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
  444.                   else
  445.                     return codepoint_to_utf8(n1)
  446.                   end
  447.                 end
  448.                 local function parse_string(str, i)
  449.                   local has_unicode_escape = false
  450.                   local has_surrogate_escape = false
  451.                   local has_escape = false
  452.                   local last
  453.                   for j = i + 1, #str do
  454.                     local x = str:byte(j)
  455.                     if x < 32 then
  456.                       decode_error(str, j, "control character in string")
  457.                     end
  458.                     if last == 92 then
  459.                       if x == 117 then
  460.                         local hex = str:sub(j + 1, j + 5)
  461.                         if not hex:find("%x%x%x%x") then
  462.                           decode_error(str, j, "invalid unicode escape in string")
  463.                         end
  464.                         if hex:find("^[dD][89aAbB]") then
  465.                           has_surrogate_escape = true
  466.                         else
  467.                           has_unicode_escape = true
  468.                         end
  469.                       else
  470.                         local c = string.char(x)
  471.                         if not escape_chars[c] then
  472.                           decode_error(str, j, "invalid escape char '" .. c .. "' in string")
  473.                         end
  474.                         has_escape = true
  475.                       end
  476.                       last = nil
  477.                     elseif x == 34 then
  478.                       local s = str:sub(i + 1, j - 1)
  479.                       if has_surrogate_escape then
  480.                         s = s:gsub("\\u[dD][89aAbB]..\\u....", parse_unicode_escape)
  481.                       end
  482.                       if has_unicode_escape then
  483.                         s = s:gsub("\\u....", parse_unicode_escape)
  484.                       end
  485.                       if has_escape then
  486.                         s = s:gsub("\\.", escape_char_map_inv)
  487.                       end
  488.                       return s, j + 1
  489.                     else
  490.                       last = x
  491.                     end
  492.                   end
  493.                   decode_error(str, i, "expected closing quote for string")
  494.                 end
  495.                 local function parse_number(str, i)
  496.                   local x = next_char(str, i, delim_chars)
  497.                   local s = str:sub(i, x - 1)
  498.                   local n = tonumber(s)
  499.                   if not n then
  500.                     decode_error(str, i, "invalid number '" .. s .. "'")
  501.                   end
  502.                   return n, x
  503.                 end
  504.                 local function parse_literal(str, i)
  505.                   local x = next_char(str, i, delim_chars)
  506.                   local word = str:sub(i, x - 1)
  507.                   if not literals[word] then
  508.                     decode_error(str, i, "invalid literal '" .. word .. "'")
  509.                   end
  510.                   return literal_map[word], x
  511.                 end
  512.                 local function parse_array(str, i)
  513.                   local res = {}
  514.                   local n = 1
  515.                   i = i + 1
  516.                   while 1 do
  517.                     local x
  518.                     i = next_char(str, i, space_chars, true)
  519.                     if str:sub(i, i) == "]" then
  520.                       i = i + 1
  521.                       break
  522.                     end
  523.                     x, i = parse(str, i)
  524.                     res[n] = x
  525.                     n = n + 1
  526.                     i = next_char(str, i, space_chars, true)
  527.                     local chr = str:sub(i, i)
  528.                     i = i + 1
  529.                     if chr == "]" then break end
  530.                     if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
  531.                   end
  532.                   return res, i
  533.                 end
  534.                 local function parse_object(str, i)
  535.                   local res = {}
  536.                   i = i + 1
  537.                   while 1 do
  538.                     local key, val
  539.                     i = next_char(str, i, space_chars, true)
  540.                     if str:sub(i, i) == "}" then
  541.                       i = i + 1
  542.                       break
  543.                     end
  544.                     if str:sub(i, i) ~= '"' then
  545.                       decode_error(str, i, "expected string for key")
  546.                     end
  547.                     key, i = parse(str, i)
  548.                     i = next_char(str, i, space_chars, true)
  549.                     if str:sub(i, i) ~= ":" then
  550.                       decode_error(str, i, "expected ':' after key")
  551.                     end
  552.                     i = next_char(str, i + 1, space_chars, true)
  553.                     val, i = parse(str, i)
  554.                     res[key] = val
  555.                     i = next_char(str, i, space_chars, true)
  556.                     local chr = str:sub(i, i)
  557.                     i = i + 1
  558.                     if chr == "}" then break end
  559.                     if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
  560.                   end
  561.                   return res, i
  562.                 end
  563.                 local char_func_map = {
  564.                   [ '"' ] = parse_string,
  565.                   [ "0" ] = parse_number,
  566.                   [ "1" ] = parse_number,
  567.                   [ "2" ] = parse_number,
  568.                   [ "3" ] = parse_number,
  569.                   [ "4" ] = parse_number,
  570.                   [ "5" ] = parse_number,
  571.                   [ "6" ] = parse_number,
  572.                   [ "7" ] = parse_number,
  573.                   [ "8" ] = parse_number,
  574.                   [ "9" ] = parse_number,
  575.                   [ "-" ] = parse_number,
  576.                   [ "t" ] = parse_literal,
  577.                   [ "f" ] = parse_literal,
  578.                   [ "n" ] = parse_literal,
  579.                   [ "[" ] = parse_array,
  580.                   [ "{" ] = parse_object,
  581.                 }
  582.                 parse = function(str, idx)
  583.                   local chr = str:sub(idx, idx)
  584.                   local f = char_func_map[chr]
  585.                   if f then
  586.                     return f(str, idx)
  587.                   end
  588.                   decode_error(str, idx, "unexpected character '" .. chr .. "'")
  589.                 end
  590.                 if type(str) ~= "string" then
  591.                     error("expected argument of type string, got " .. type(str))
  592.                 end
  593.                 local res, idx = parse(str, next_char(str, 1, space_chars, true))
  594.                 idx = next_char(str, idx, space_chars, true)
  595.                 if idx <= #str then
  596.                     decode_error(str, idx, "trailing garbage")
  597.                 end
  598.                 return res
  599.             end
  600.         }
  601.        
  602.     }
  603.     local lastUpdate =  1547917483395 + 2628*10^6 -- 15:05 | 19/01/2019
  604.     require = function(libName)
  605.         if libName == 'hide-warning' then
  606.             lastUpdate = false
  607.         else
  608.             if lastUpdate and os.time() > lastUpdate then
  609.                 lastUpdate = false
  610.                 print("<R>Warning! You may be using an outdated version of require, check in <i>atelier801.com/topic?f=6&t=880333</i> if this has a better version, otherwise you can disable this warning with require('hide-warning').</R>")
  611.             end
  612.             if libs[libName] then
  613.                 if libs[libName]['INIT_SCRIPT'] and type(libs[libName]['INIT_SCRIPT']) == 'function' then
  614.                     libs[libName]['INIT_SCRIPT']()
  615.                     libs[libName]['INIT_SCRIPT'] = nil
  616.                 end
  617.                 return libs[libName]
  618.             elseif libName == 'libs' then
  619.                 return libs
  620.             else
  621.                 print('Library "'..libName..'" not found! <i>Require Version: 1.2.2 | Author: Nettoork#0000</i>')
  622.                 return false
  623.             end
  624.         end
  625.     end
  626. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement