Saturday 10 June 2017

multidimensional Array in node.js storing a mysql database

I'm trying to limit database hits on my RPG Bot in DISCORD and so decided to store an initall lookup of my database as an internal array so that when doing data look up i can just loop through my array and look for where

UserList[i][ID] is equal to the id of the responding user. This is how my database lookup works i'm just offloading it to an array so Id.Of.comment.owner = SomeNumber fetch from mysql database user whos id is SomeNumber

but now i'll be doing more of a For (i =0; i < userlist.length; i++) if userlist[i][ID] = Somenumber --Do something

And i just want to make surei understand how i set up a multi dimensioal array in node.js

Obviously i'll have to prock the database one and loop through that but what is the syntax to init and fill is it just

var Userlist[][];

then

for (h=0; h< sizeofdatabase; h++)
UserList[h][id]
...
UserList[h][PLACEHOLDER_xp_percent]
UserList[h][PLACEHOLDER_rank]
UserList[h][PLACEHOLDER_rank_total]



via NekoLLX

No comments:

Post a Comment