xeon17 Posted August 22, 2015 Posted August 22, 2015 Just don't convert the money and the problem is solved.
1LoL1 Posted August 22, 2015 Author Posted August 22, 2015 Just don't convert the money and the problem is solved. but i need convert
xeon17 Posted August 22, 2015 Posted August 22, 2015 Just don't convert the money and the problem is solved. but i need convert Can you explain why?
t3wz Posted August 23, 2015 Posted August 23, 2015 I don't see point of saving a converted number, but if you want just use this function to 'unconvert' the 'number': function unconvertNumber ( number ) local result = number:gsub ( ",", "" ); return tonumber ( result ); end obs: you can convert the number directly in the function, there is no need to use 'unconvertNumber'. about saving lang, you have to edit your "CREATE TABLE [...]" to support other column.
1LoL1 Posted August 23, 2015 Author Posted August 23, 2015 I don't see point of saving a converted number, but if you want just use this function to 'unconvert' the 'number': function unconvertNumber ( number ) local result = number:gsub ( ",", "" ); return tonumber ( result ); end obs: you can convert the number directly in the function, there is no need to use 'unconvertNumber'. about saving lang, you have to edit your "CREATE TABLE [...]" to support other column. what with this? function unconvertNumber ( number ) local result = number:gsub ( ",", "" ); return tonumber ( result ); end i need to use here local money = getPlayerMoney ( source ) -- save 99,999,999$ setPlayerMoney ( source, poll[1]["Money"] ) -- load 99999999$ or 99,999,999$
Addlibs Posted August 24, 2015 Posted August 24, 2015 Why would you want to save the money formatted? It should be a number value. You need to alter your SQL table if you want to store a string instead of a number. Its a lot more efficient to store the number 99,999,999 as 99999999 (4 bytes) than as 99,999,999 (10 bytes) (it's not because of the commas), furthermore, all Lua functions take money as a number, not a formatted string, so you'll waste CPU to un-format the number.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now