Gets information on a regional variable of a given activation record
lua_getinfo
In order to get information regarding a work invocation, the factor ar need to be a legitimate activation record that has been loaded by an earlier name to lua_getstack or offered as discussion to a hook (see lua_Hook ).
Attain information on a work your press it onto the heap and commence the just what sequence utilizing the dynamics ‘ > ‘. (Therefore, lua_getinfo pops the event from inside the top of the pile.) By way of example, to know in which range a function f is identified, it is possible to write the subsequent laws:
- ‘ letter ‘: fills in that particular niche term and namewhat ;
- ‘ S ‘: fills inside the areas origin , short_src , linedefined , lastlinedefined , and what ;
- ‘ l ‘: fills in that particular niche currentline ;
- ‘ u ‘: fills on the go nups ;
- ‘ f ‘: forces onto the heap the function that’s operating within considering degree;
- ‘ L ‘: pushes onto the bunch a dining table whoever indicator include variety of the contours which are good on the function. (A valid range try a line which includes associated rule phrendly Profily, that will be, a line where you can set a rest aim. Non-valid outlines add empty contours and statements.)
lua_getlocal
The factor ar must be a valid activation record which was overflowing by an earlier name to lua_getstack or considering as discussion to a hook (read lua_Hook ). The index n selects which regional variable to check (1 could be the very first factor or effective local varying, and so forth, through to the last energetic local adjustable). lua_getlocal forces the variable’s price on the bunch and returns the name.
Variable labels beginning with ‘ ( ‘ (available parentheses) signify internal factors (loop regulation variables, temporaries, and C purpose locals).
lua_getstack
This features fulfills components of a lua_Debug structure with a recognition of activation record on the function executing at confirmed levels. Level 0 will be the current working features, whereas amount n+1 will be the purpose who has known as degree n. When there will be no errors, lua_getstack profits 1; when called with a level greater than the pile range, they returns 0.
lua_getupvalue
Gets information on a closure’s upvalue. (For Lua features, upvalues will be the external neighborhood variables the work utilizes, and therefore include as a result incorporated into its closure.) lua_getupvalue receives the directory letter of an upvalue, pushes the upvalue’s benefits on the bunch, and return its label. funcindex points to the closing within the stack. (Upvalues haven’t any particular order, because they’re effective through the complete purpose. Thus, they’ve been numbered in an arbitrary order.)
Profits NULL (and forces little) if the list is more than how many upvalues. For C performance, this features makes use of the empty string “” as a name for many upvalues.
lua_Hook
When a hook is called, their ar debate has its own field celebration set to the particular celebration that induced the hook. Lua recognizes these happenings making use of the after constants: LUA_HOOKCALL , LUA_HOOKRET , LUA_HOOKTAILRET , LUA_HOOKLINE , and LUA_HOOKCOUNT . Additionally, for range occasions, industry currentline is also set. To have the worth of another field in ar , the hook must call lua_getinfo . For return happenings, show could be LUA_HOOKRET , the standard advantages, or LUA_HOOKTAILRET . From inside the latter situation, Lua try simulating going back from a function that did a tail phone call; in this situation, really ineffective to name lua_getinfo .
While Lua is working a hook, they disables some other phone calls to hooks. Thus, if a hook calls back once again Lua to implement a function or a chunk, this performance happen without any calls to hooks.
Leave a reply