Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.tcp.im.builtinResponders.state.script
on script (driverName, screenname, message) {
on incorrectsyntax () {
tcp.im.send (driverName, screenName, "Incorrect syntax. Send a message in the format: state [xx] -- where xx is a number from 1 to 50.");
return};
local (s = string.delete (message, 1, sizeof ("state")));
s = string.trimwhitespace (s);
if not (s beginswith "[") {
incorrectsyntax ()};
if not (s endswith "]") {
incorrectsyntax ()};
s = string.mid (s, 2, sizeof (s) - 2);
tcp.im.send (driverName, screenName, states.nthstate (number (s)))}
<<bundle //test code
<<dialog.alert (script ("xxx", "state (12)"))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.