char[] GetString1() // Notice the return type, 'char[]' and not 'char'. This indicates that it should return an array of characters instead of just one. { return "string1"; }
char[] GetString2() { return "string2"; }
Natives cannot return arrays, but within a plugin it works just fine.
EDIT: If we would've had 'real' strings, we would see a lot more of this, since natives would be able to return them.
in documentation error: https://sm.alliedmods.net/new-api/sd...nd/NormalSHook
this:
typedef NormalSHook = function Action(int clients[64], int &numClients, char sample[], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags)
should be:
typedef NormalSHook = function Action(int clients[64], int &numClients, char[] sample, int &entity, int &channel, float &volume, int &level, int &pitch, int &flags)
It's missing the constant as well as its value in the display.
I'd guess we can do better, dvander?
Quote:
Originally Posted by Electr000999
in documentation error: https://sm.alliedmods.net/new-api/sd...nd/NormalSHook
this:
typedef NormalSHook = function Action(int clients[64], int &numClients, char sample[], int &entity, int &channel, float &volume, int &level, int &pitch, int &flags)
should be:
typedef NormalSHook = function Action(int clients[64], int &numClients, char[] sample, int &entity, int &channel, float &volume, int &level, int &pitch, int &flags)
It's more complicated than that unfortunately. You'd end up seeing something like "char blah[255]" which is not quite what you want to see. You want "blah[PLATFORM_MAX_PATH]". We have a similar problem with default arguments.
The docgen tool is three steps:
(1) Do a full parse/type check of the .inc.
(2) Export .json of where every comment begins and ends in the .inc.
(3) Use the .json and .inc file to populate a MySQL database.
So we could expand on step 2. For example, "char blah[PLATFORM_MAX_PATH]" could be recorded as having its type at indices (10, 26] and step 3 would need to just cut that string out of the file instead of pretty-printing.