Lua add table line to table with multiple variables

692 views Asked by At
user = {
        {uid = "IFOZOTj1JXubBSg26nkhW9yHlwU=", coins = 800, dmod = 0, nmod = 0},
        {uid = "nlncgruCSwId39q2TRSjCnEtgQA=", coins = 200, dmod = 1434246406, nmod = 0}
}

This is my current table structure.

Now I want to add a new line the keys are static:

uid, coins, dmod, nmod 

and the values are variables

_uid, _coins, _dmod, _nmod

I checked this but can't get it to work.

1

There are 1 answers

1
lhf On BEST ANSWER

Try

user[#user+1] = { uid=_uid, coins=_coins, dmod=_dmod, nmod=_nmod }