Suggestion: return types of AGS functions listed in Help file

Started by SSH, Tue 12/08/2003 17:26:08

Previous topic - Next topic

SSH

The help file doesn't give the types of return values (int, string or void) for built-in functions. This might be handy and avoid confusion.

As evidenced in this thread: http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=7835

EDIT: Apologies for mentioning this suggestion in two threads. Is that the right way to do it? If not, what is and can there be some guidance on that in the FAQ for the tech forum, please?

THX!
12

Gilbert

Actually I think all AGS built-in functions will only return int values.

The reason is that direct reference for string is NOT supported in AGS, so you CANNOT do this:
string blah = "HAHAHAHA!"; //NEVER DO THIS!

And of course there're functions like:
StrGetCharAt()
which return a "char" value, but due to casting, you can use a int, short or char variable to hold its value anyways.

And for those functions that "won't return a value", I think they actually returns something, but with unexpected value (from what I tested with GUIOn() and GUIOff()).

So it's safe to assume that all functions just return integer values.

Pumaman

I see what you're getting at.

Gilbot is right in that commands either return nothing, or an int. Therefore, if the manual description for the command mentions that it returns anything, it is an int. If not, then nothing is returned.

Perhaps these do need to be explicitly listed somewhere though.

SSH

Also, it will help when AGS 4.32 starts to support complex data types, like strings, lists, records, hashes, anything else that perl has, etc... ;)

Now, there's an idea... a perl plugin for AGS  ;D
12

Pumaman

Bloody hell, we have enough problems debugging people's scripts as it is - I can only imagine the nightmares which would ensue scripting in Perl ;)

SSH

Actually I had an idea the other day:

How plausible is it for the plugin API to have a callback (maybe only in debug mode) on each new script line, and some way to know which line of a script is being executed? This could allow someone to write an AGS  debugger plugin...!

That would be v. cool!
12

Pumaman

That's a good idea - adding a callback wouldn't be too difficult. I'll add it to my list.

SMF spam blocked by CleanTalk