Basic Print Commands

Jun 10, 2007 13:42

Sorry for posting this here, but finding an active community regarding the programming side of S2 is proving to be a bit difficult...

I recently started playing around in S2 (after about a year of having my brain melt every time I tried to look at it...), and I have a programming question. If I knew a bit about Perl or Java, this might be self evident, but previously, I've only worked in PHP. My question concerns whether you should always include a print command and what exactly the "safe" modifier does.

There seem to be two printing commands, print and println. println, I assume, prints the line followed by a line separator. I have noticed, however, that a lot of functions written tend to just dump strings out there, and they are printed. For example, the following would produce the same effect:

print "I like printing!";

"I like printing!";

That doesn't work with variables, just with strings. Also, there is a "safe" modifier, and I have absolutely no idea what that does. Does that prevent the string from being cleaned or does it require the string to be cleaned before printing?

print safe "I like printing!";

So, should a print command always be included? Is just dumping out a string bad programming? Also, how does safe printing differ from normal printing?

Thank you ahead of time. Sorry if this question is a bit basic, but like I said, I have limited experience with programming languages.

Cross posted to s2dev [here] and kinda sent to s2practice (before I realized that the mods haven't passed anything through in nearly a year. Duh.).
Previous post Next post
Up