Weird behavior in usersGetUsername

So i am trying to optimize my code and currently using usersGetUsername to fetch user info.

I was using it like this on my previous builds

let toUserInfo: nkruntime.User = nk.usersGetUsername([payer_email])[0]
let systemUserInfo: nkruntime.User = nk.usersGetUsername([systemUserName])[0]
let operationsUserInfo: nkruntime.User = nk.usersGetUsername([operationsUserName])[0]
let noUplineUserInfo: nkruntime.User = nk.usersGetUsername([noUplineUserName])[0]

To optimize the code i have implemented this:

let fetchUsers: nkruntime.User[] = nk.usersGetUsername([payer_email, systemUserName, operationsUserName, noUplineUserName])
let toUserInfo: nkruntime.User = fetchUsers[0]
let systemUserInfo: nkruntime.User = fetchUsers[1]
let operationsUserInfo: nkruntime.User = fetchUsers[2]
let noUplineUserInfo: nkruntime.User = fetchUsers[3]

As it’s an array, i am expecting the returned data to be with the same index order that i inputted.
Unfortunately this is the result:


The array response was jumbled.

Hey seiferxiii, the usersGetUsername function is not guaranteed to return the same order as the input usernames. Instead you should cross-reference the returned objects with the original IDs you passed in order to get the username.