#Humber* Posted June 30, 2016 Share Posted June 30, 2016 Hi all, I am doing something like this. function getServerMoney() local moneyS = {} for k,v in ipairs(getElementsByType("player")) do local moneyP = getPlayerMoney(v) table.insert(moneyS, moneyP) end end I want to + all de values in the table, can you help me please? Link to comment
Tails Posted June 30, 2016 Share Posted June 30, 2016 You don't have to put the values in a table. Just do: function getServerMoney() local moneyS = 0 for k,v in ipairs(getElementsByType("player")) do local moneyP = getPlayerMoney(v) moneyS = moneyS + moneyP end return moneyS end local moneyS = getServerMoney() outputChatBox(moneyS) Link to comment
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