New functions added in version 1.021

Go down

New functions added in version 1.021

Post  Ellypse on Sun Feb 02, 2014 5:21 am

These function will be added to totalRP2_API.lua

function TRP2_DeleteColorCode(chaine)
 if (chaine == nil) then
 return "";
 return string.gsub(chaine, "{%w*}", "");
Proposed by Zax, this function return the string it's given without the color tokens.
I changed Zax's code from string.gsub(chaine, "{.*}", "") to string.gsub(chaine, "{%w*}", ""), to make sure it doesn't delete new lines token.
This function is used for displaying name using %t in /emote, and for disabling color for names in chat and color in the entire tooltip.
It is also used when sending informations to other RP addons using Mary Sue Protocol.

function TRP2_GetInt(value)
 return math.floor(tonumber(value));
This function return the int for the string or float it's given.
This function is used for bulletproofing Total RP agains't the corruption caused by patch 5.4. Sliders were returning float values instead of int, that were inserted into the creation files and made the addon crash when trying to open it. Using this, even if incorrect float values are inserted, Total RP will cast them to int.
I like to think of this as a divine shield  Wink

Ellypse, Culte de la Rive Noire, FR
Moedra, Kirin Tor, FR
Maison Celwë'Belore, Officer

Posts : 215
Join date : 2013-09-26
Age : 26
Location : Paris, France

View user profile

Back to top Go down

Back to top

Permissions in this forum:
You cannot reply to topics in this forum