PAWN printing line number?
#1

I know what the answer is going to be but, is there by any chance a way of printing what line a certain piece of code is on? At a wild guess something like

pawn Код:
print("Hello, I am on line "#line"!");
?

I doubt it for some reason.
Reply
#2

Yes, I think it is posible.
I see only one way of doing it.
I know how to do it in Dev C++ and I think you can here as well.
You need know how to use file functions as fscanf( I think this exist in pawn aswell)
Open your gamemode, in the same way you are opening your scriptfiles. And chech line by line ( using counter) and once you with strcmp get te exact line you can print it.

If some lines are same, use comments( /* //)
Reply
#3

Sadly, it's not possible. I once searched for it as well. The manual refers to __line as a predefined constant (page 104), but that one doesn't work. Unlike __Pawn (which shows the current Pawn version in BCD) which does work.
Reply
#4

It is not possible.
#line directive sets (internally, for compiler uses) line number.

EDIT: You could actually do it because it's saved for debug purposes(debug level should be set accordingly) but there would be a lot of boiler-plate(because you cannot make #emit into macro)
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Which manual did you check? The one from the website (new version) or this one (SA-MP version):

https://sampforum.blast.hk/showthread.php?tid=289258
Neither. I have this version of August 2007.
For reference: https://dl.dropbox.com/u/60044532/pawn-lang.pdf
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)