-
Example : -- main.nelua
print(relative file path, file name, line number)
-- the print statement is at line number 15 the output should look something like this
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is what you wanted: print(#[srcloc.srcname..':'..srcloc.lineno]#) -- outputs "test.nelua:1" The You could also create a polymorphic function that gets instantiated at every call, and print the source location where the polymorphic function was instantiated using local function f() <alwayspoly>
print(#[polysrcloc.srcname..':'..polysrcloc.lineno]#)
end
f() -- outputs "test.nelua:5" The Both ways is supported since commit 2fe098d |
Beta Was this translation helpful? Give feedback.
This is what you wanted:
The
srcloc
variable is a preprocessor table that always have the source location for the current node being processed.You could also create a polymorphic function that gets instantiated at every call, and print the source location where the polymorphic function was instantiated using
polysrcloc
:The
polysrcloc
variable is a preprocessor table that always have the source location where the current polymorphic function being processed was instantiated.Both ways is supported…