Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- A function to parse data in text.
- function openAura:ParseData(text)
- local classes = {"%^", "%!"};
- for k, v in ipairs(classes) do
- for key in string.gmatch(text, v.."(.-)"..v) do
- local lower = false;
- local amount;
- if (string.sub(key, 1, 1) == "(" and string.sub(key, -1) == ")") then
- lower = true;
- amount = tonumber( string.sub(key, 2, -2) );
- else
- amount = tonumber(key);
- end;
- if (amount) then
- text = string.gsub( text, v..string.gsub(key, "([%(%)])", "%%%1")..v, tostring( FORMAT_CASH(amount, k == 2, lower) ) );
- end;
- end;
- end;
- for k in string.gmatch(text, "%*(.-)%*") do
- k = string.gsub(k, "[%(%)]", "");
- if (k != "") then
- text = string.gsub( text, "%*%("..k.."%)%*", tostring( self.option:GetKey(k, true) ) );
- text = string.gsub( text, "%*"..k.."%*", tostring( self.option:GetKey(k) ) );
- end;
- end;
- if (CLIENT) then
- for k in string.gmatch(text, ":(.-):") do
- if ( k != "" and input.LookupBinding(k) ) then
- text = string.Replace(text, ":"..k..":", "<"..string.upper( tostring( input.LookupBinding(k) ) )..">");
- end;
- end;
- end;
- return self.config:Parse(text);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement