var user_list = []; // ??
d = new User(n)
if(u.number == d.number) continue; if(d.settings&(USER_DELETED|USER_INACTIVE)) continue;
if(u.name == d.name)
{
... do some stuff and add the values to an array
that can be accessed by the index [x] later on
is there a push.dup_user(user_list) type expression?
}
Re: Add and object to an array
By: Mortifis to All on Thu Jul 18 2019 17:04:09
var user_list = []; // ??
d = new User(n)
if(u.number == d.number) continue; if(d.settings&(USER_DELETED|USER_INACTIVE)) continue;
if(u.name == d.name)
{
... do some stuff and add the values to an array
that can be accessed by the index [x] later on
is there a push.dup_user(user_list) type expression?
}
user_list.push({
number: d.number,
alias: d.alias,
...
});
for (var i = 0; i < user_list.length; i++) {
print(user_list[i]+"\r\n");
}
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 17:40:34
for (var i = 0; i < user_list.length; i++) { print(user_list[i]+"\r\n");
}
Then you'd get a whole bunch of [object Object] output or something similar (you're trying
to print each array element, as a string, but they're objects). Something like this:
print(user_list[i].alias + '\r\n');
or this:
print(JSON.stringify(user_list[i]));
or this, without the for loop:
print(JSON.stringify(user_list));
I tried a bunch of methods I researched but none of them worked. still not sure how to get console.log() to work, says undefined.
var user_list = []; // ??
... do some stuff and add the values to an array
that can be accessed by the index [x] later on
is there a push.dup_user(user_list) type expression?
Re: Add and object to an array
By: Mortifis to All on Thu Jul 18 2019 05:04 pm
var user_list = []; // ??
... do some stuff and add the values to an array
that can be accessed by the index [x] later on
is there a push.dup_user(user_list) type expression?
If I understand you, do you want to add/append to the user_list array? You should be able to do this:
user_list.push(dup_user);
You can also append literal objects:
user_list.push({
number: '',
alias: '',
num: '',
email: '',
dup_alias: '',
dup_num: '',
dup_email: ''
});
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 18:30:52
I tried a bunch of methods I researched but none of them worked. still not sure how to get console.log() to work, says undefined.
console.log() is a thing in web browsers and in node.js, but not in Synchronet's JS
environment. Some JS examples you see on the web won't transfer perfectly into this space.
We do have the log(level, message) function here:
log(LOG_DEBUG, 'This is a debug message');
or you can omit the loglevel parameter:
log('This is a message, probably at the INFO level (?)');
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 18:30:52
I tried a bunch of methods I researched but none of them worked. still not sure how to get console.log() to work, says undefined.
console.log() is a thing in web browsers and in node.js, but not in Synchronet's JS
environment. Some JS examples you see on the web won't transfer perfectly into this space.
We do have the log(level, message) function here:
log(LOG_DEBUG, 'This is a debug message');
or you can omit the loglevel parameter:
log('This is a message, probably at the INFO level (?)');
I saw that, I had thought that writes to a file in /sbbs/data/logs/
I saw that, I had thought that writes to a file in /sbbs/data/logs/
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 20:16:09
I saw that, I had thought that writes to a file in /sbbs/data/logs/
It goes wherever your log output goes (which varies with how your BBS is set up).
Where are you hoping to see these messages appear?
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 20:16:09
I saw that, I had thought that writes to a file in /sbbs/data/logs/
It goes wherever your log output goes (which varies with how your BBS is set up).
Where are you hoping to see these messages appear?
just standard stdout (the screen) to generate a menu.
const dupUser = dup_list.find(dup_list => dup_list.number === edit);
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 20:16:09
I saw that, I had thought that writes to a file in /sbbs/data/logs/
It goes wherever your log output goes (which varies with how your BBS is set
Hmmm ... I used log(LOG_INFO,"dup_user_check: (" + dateTime + ") " + msg); but I do not see the entry in any /sbbs/data/logs/*.log file :/
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 20:16:09
I saw that, I had thought that writes to a file in /sbbs/data/logs/
It goes wherever your log output goes (which varies with how your BBS is set
Hmmm ... I used log(LOG_INFO,"dup_user_check: (" + dateTime + ") " + msg); but I do not see the entry in any /sbbs/data/logs/*.log file :/
Re: Re: Add and object to an array
By: Mortifis to echicken on Sat Jul 20 2019 02:03 pm
Re: Re: Add and object to an array
By: Mortifis to echicken on Thu Jul 18 2019 20:16:09
I saw that, I had thought that writes to a file in /sbbs/data/logs/
It goes wherever your log output goes (which varies with how your BBS is set
Hmmm ... I used log(LOG_INFO,"dup_user_check: (" + dateTime + ") " + msg); but I do not see the entry in any /sbbs/data/logs/*.log file :/
log() output from jsexec goes to stdout by default. But there are command-line options to control where the console output from jsexec goes.
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,055 |
Nodes: | 17 (1 / 16) |
Uptime: | 00:22:36 |
Calls: | 501,023 |
Calls today: | 10 |
Files: | 109,384 |
D/L today: |
2,147 files (166M bytes) |
Messages: | 304,875 |
Posted today: | 1 |