To obtain information regarding a work invocation, the parameter ar needs to be a valid activation record that has been filled by a previous call to lua_getstack or provided as argument to a hook (discover lua_Hook ).
Receive information on a purpose you drive it onto the stack and start the exactly what sequence together with the personality ‘ > ‘. (Therefore, lua_getinfo pops the event inside the top of pile.) For-instance, to understand by which line a function f was defined, you’ll be able to compose listed here laws:
- ‘ letter ‘: fills in the field identity and namewhat ;
- ‘ S ‘: fills inside areas resource , short_src , linedefined , lastlinedefined , and just what ;
- ‘ l ‘: fills on the go currentline ;
- ‘ u ‘: fills in that particular niche nups ;
- ‘ f ‘: pushes on the bunch the big event which working at the offered degree;
- ‘ L ‘: forces onto the bunch a dining table whose indicator would be the quantities of the lines which happen to be good from the function. (A valid range is actually a line with a few associated laws, that will be, a line where you can place some slack point. Non-valid traces feature unused lines and remarks.)
The factor ar need to be a legitimate activation record that has been filled by a past phone call to lua_getstack or given as argument to a hook (read lua_Hook ). The index letter selects which regional diverse to inspect (1 will be the very first parameter or energetic local varying, and so on, up until the last active local changeable). lua_getlocal forces the diverse’s value on the bunch and returns their name.
Changeable labels you start with ‘ ( ‘ (available parentheses) signify internal variables (loop control factors, temporaries, and C work natives).
This features fulfills elements of a lua_Debug structure with a recognition of activation record in the work executing at certain stage. Levels 0 is the current run features, whereas stage n+1 could be the purpose which includes also known as degree letter. When there will be no mistakes, lua_getstack comes back 1; when labeled as with an even more than the bunch range, it comes back 0.
Has details about a closing’s upvalue. (For Lua performance, upvalues include external neighborhood variables your function makes use of, and that is subsequently a part of their closing.) lua_getupvalue gets the directory letter of an upvalue, forces the upvalue’s value onto the stack, and returns their name. funcindex things to the closing inside the stack. (Upvalues don’t have any specific purchase, because they are effective through the whole work. Thus, they’re numbered in an arbitrary purchase.)
Comes back NULL (and forces absolutely nothing) as soon as the list is more than the amount of upvalues. For C applications, this work utilizes the empty string “” as a reputation regarding upvalues.
Each time a hook is known as, the ar debate has its area occasion set-to the precise occasion that caused the hook. Lua determines these activities utilizing the following constants: LUA_HOOKCALL , LUA_HOOKRET , LUA_HOOKTAILRET , LUA_HOOKLINE , and LUA_HOOKCOUNT . Furthermore, for line occasions, industry currentline is ready. To have the value of almost every other industry in ar , the hook must phone lua_getinfo . For return activities, occasion is LUA_HOOKRET , the typical price, or LUA_HOOKTAILRET . Within the second circumstances, Lua is simulating going back from a function that performed a tail name; in this case, it’s https://datingmentor.org/petite-dating/ useless to contact lua_getinfo .
While Lua try operating a hook, it disables other telephone calls to hooks. Thus, if a hook calls back once again Lua to execute a function or a chunk, this performance happen without the calls to hooks.