nx::current(3nx)
π nx::current β the NX API tea, served hot π
okay bestie, sit down, we're talking about nx::current from the NX API (that's section 3nx of the manual, iykyk). this one is the gossip girl of the callstack. it spills everything. β¨
β¨ SYNOPSIS β¨
current ?option?
π¦ DESCRIPTION π¦
current ?option?
so, current ?option? is an introspection command, and honestly? it's giving main character energy. you call it from inside a method body and it hands you all the deets about the callstack β which specific deets you get depends on what you pass as option. if you don't pass an option at all, nx::current just defaults to the object option (scroll down, it's there π
).
the way this works: nx::current operates on the Tcl callstack, but it's also fully aware of the NX-specific callstack and stackframe details. so it sees more than plain Tcl does. periodt.
β οΈ heads up: apart from thecallinglevelandleveloptions, callingnx::currentoutside an NX object or method is gonna throw an error. so like, don't do that. π
option can be literally any of these:
activelevelβ returns the actual callstack level that calls directly into the method that's running right now. thisactivelevelmight line up with thecallinglevel, but ngl, it doesn't have to. theactivelevelalso counts the intermediate calls, likenx::nextinvocations. the level comes back as an absolute level number (that's a#followed by a digit) so you can pass it straight in as the first argument touplevelorupvar. π«Άargsβ returns the list of argument values that got passed into the method implementation currently executing. the receipts, basically. π§Ύcalledclassβ returns the name of the class that provides the method implementation that the intercepted method call is being redirected to. (only available from inside filter methods! no filter, no answer, sorry bestie.) πcalledmethodβ returns the original method name that was requested by the intercepted method call. (also only available from inside filter methods.) β¨callingclassβ returns the name of the class that provides the method implementation which is calling into the method executing right now. see alsocallingobject. πcallinglevelβ resolves the callstack level of the originating invocation of the method implementation currently executing. callstack levels introduced by method interception (like filters) and by method combination (nx::next) get ignored. the level is reported as an absolute level number (#followed by a digit) so you can hand it directly touplevelorupvaras the first argument. see alsoactivelevel. and if you call it outside NX? you get1back β which is the default forupvaranduplevel. cute, right? πΈcallingobjectβ returns the name of the object that's calling into the method currently executing. see alsocallingclass. πclassβ returns the name of the class providing the method implementation that's executing right now. plot twist: the returned method-providing class can be different from the class of the current object. and if you call it from inside a method implementation that's provided by the current object itself? you get an empty string. πfilterregβ returns the object (class) on which the currently executing method was registered as a filter method. (only available from inside filter methods, obviously.) π₯isnextcallβ returns1if the method implementation executing right now was invoked vianx::next;0otherwise. simple as that. βlevelβ returns a number indicating the stack level of the method or script executing right now, or an empty string when you're running outside an NX context (say, in a Tcl proc or a namespace script). the resulting value can be passed directly as level toinfo level. no conversion needed, we love efficiency. βmethodβ returns the name of the method currently executing. if it's an ensemble-method call, you get the name of the bottom-most ("leaf") method. πmethodpathβ returns the combined name of the method currently executing (including all the ensemble levels) in an ensemble-method call. for a regular method call though? the result matches whatever optionmethodwould've given you. same vibe, different route. πnextmethodβ returns the name of the next most specific method implementation that'll be called when you invokenx::next. the sneak peek. πobjectβ gives you the name of the object on which the method implementation currently executing is evaluated. this is the default option, so if you're lazy (valid) this is what you get. π
π COPYRIGHT π
Copyright (c) 2014-16 Stefan Sobernig <stefan.sobernig@wu.ac.at>, Gustaf Neumann <gustaf.neumann@wu.ac.at>; available under the Creative Commons Attribution 3.0 Austria license (CC BY 3.0 AT).
and that's the whole page, bestie π
this was nx::current(3nx) from the NX API, version 2.4.0, and it literally ate. go introspect something iconic. π¦β¨π
π¦ where this page comes from
- debian trixie: nsf 2.4.0-1 Β· MIT
- ubuntu questing: nsf 2.4.0-1
- ubuntu resolute: nsf 2.4.0-1build1 Β· MIT
- ubuntu stonking: nsf 2.4.0-1build1 Β· MIT
- Copyright (c) 2014-16 Stefan Sobernig <stefan\&.sobernig@wu\&.ac\&.at>, Gustaf Neumann <gustaf\&.neumann@wu\&.ac\&.at>; available under the Creative Commons Attribution 3\&.0 Austria license (CC BY 3\&.0 AT)\&
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms