Reflection/Get source: Difference between revisions

m
(→‎{{header|Lua}}: added Lua solution)
Line 359:
A caught exception (see the documentation for throw) contains the line number, file, and path (with the same caveat as above when installed elsewhere).
 
The file pincpathN.e also shows you how to get your grubby little mitts on the symbol table, and you may also want to look at builtins/VM/prtnidN.e for some ideas on scanning that. Throwing and catching an exception is one way to ensure the symbol table is populated with proper names rather than obscure integer ternary tree indexes. See pglobals.e for detailed notes about the contents of the symbol table. Some caution is advised here; the compiler mymay plant some otherwise illegal raw values in the symbol table, and play fast and loose with reference counts, etc, and of course messing it up may make life (/subsequent debugging) rather troublesome.
 
Of course the source files are just files that you can read like any other text files, and for all its detail, the symbol table contains very little in the way of context, which may make mapping of non-unique identifiers rather difficult.
7,806

edits