Debugging

62 views
Skip to first unread message

PHY ZYX

unread,
Nov 15, 2013, 12:10:13 PM11/15/13
to pawns...@googlegroups.com
So this is a general question because I am developing a script using pawn.
Is there an internal function using pawn to for example print the function name.
Like:
new DebugMsg[128];
forward Debug(message[]);

Debug(message[])
{
format(DebugMsg, sizeof(DebugMsg), "%s", message);
return 1;
}

public ExampleFunction()
{
Debug(GetFuncName());
return 1;
}

Is it possible to get the name of the function without needing to manually type it?

PHY ZYX

unread,
Nov 15, 2013, 12:11:06 PM11/15/13
to pawns...@googlegroups.com
I am scripting for the San Andreas Multiplayer Mod

Petteri Aimonen

unread,
Nov 15, 2013, 12:47:41 PM11/15/13
to pawns...@googlegroups.com
Hi,

> Is it possible to get the name of the function without needing to manually
> type it?

Not that I know of. You could implement it as a native function, but I
guess in your application modifying the interpreter is not an option.

The closest equivalent is the __line constant, which gives the line
number.

--
Petteri

PHY ZYX

unread,
Nov 15, 2013, 2:13:00 PM11/15/13
to pawns...@googlegroups.com
I'm not great with creating natives.
How would I do that? As creating a native can be done within include files.

And how does the constant __line work? For example, when I do:
new string[128];
format(string, sizeof(string), "Line: %d", __Line);
it shows an error on the format line because theres no __Line variable or constant set?
Reply all
Reply to author
Forward
0 new messages