User Tools

Site Tools


getting_20the_20current_20line_20number

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
getting_20the_20current_20line_20number [2018/03/31 13:19] – external edit 127.0.0.1getting_20the_20current_20line_20number [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 //by Jon Ripley, Richard Russell, January 2012//\\ \\  The **FN_linenumber(!384)** function returns the line number of the currently executing line of code as demonstrated below.\\  //by Jon Ripley, Richard Russell, January 2012//\\ \\  The **FN_linenumber(!384)** function returns the line number of the currently executing line of code as demonstrated below.\\ 
 +<code bb4w>
   12345 PRINT FN_linenumber(!384)   12345 PRINT FN_linenumber(!384)
         END         END
  
         DEF FN_linenumber(E%)         DEF FN_linenumber(E%)
-        LOCAL P% : P% = PAGE +        LOCAL p%% : p%% = PAGE 
-        WHILE ?P% AND P% + ?P% < E% P% += ?P% : ENDWHILE +        WHILE ?p%% AND p%% + ?p%% < (E% + PAGE - !340) p%% += ?p%% : ENDWHILE 
-        = (P%?2*256+P%?1)+        = (p%%?2*256+p%%?1) 
 +</code>
 Always pass **!384** as the parameter to FN_linenumber, this [[/Interpreter%20internal%20variables|interpreter internal variable]] is the pointer to (or within) currently-executing statement. Always pass **!384** as the parameter to FN_linenumber, this [[/Interpreter%20internal%20variables|interpreter internal variable]] is the pointer to (or within) currently-executing statement.
getting_20the_20current_20line_20number.1522502363.txt.gz · Last modified: 2024/01/05 00:17 (external edit)