Door Games Unlimited

Welcome, Guest.


Subject: console.putmsg alternative that returns a string Date: Mon Oct 06 2014 12:47:50
From: Nightfox To: Psi-Jack

 >  Ps>> text = text.replace(/@([^@]+)@/g, function(m, code) {
 >  Ps>> return bbs.atcode(code);
 >  Ps>> });
 > 
 >  Ni> That seems to work well.  I'm curious, how did you find that you 
could
 >  Ni> use an anonymous function for the replacement value in the 
JavaScript
 >  Ni> string replace() method?  I've often referred to the w3schools.com
 >  Ni> JavaScript documentation, and their documentation for the string
 >  Ni> replace() method seems to imply that it expects a string for the
 >  Ni> replacement value: www.w3schools.com/jsref/jsref_replace.asp
 > 
 > Well, I didn't.. This is just stuff Deuce came up with for the
 > newuser_signup.js I've been testing. ;)

Ah, I see.
I tried the code that you shared, and I think it might need some more
tweaking, as it seems it will replace text around a @ even if it's not a valid
Synchronet @-code..

Nightfox

---
 ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net

Previous Message       Next Message
In Reply To: console.putmsg alternative that returns a string (Psi-Jack)
Replies: console.putmsg alternative that returns a string (Deuce)