Skip to main content

Frame

Struct Frame 

Source
pub struct Frame {
    pub closure: Gc<LuaClosure>,
    pub base: u32,
    pub pc: u32,
    pub func_slot: u32,
    pub n_varargs: u32,
    pub nresults: i32,
    pub hook_oldpc: u32,
    pub from_c: bool,
    pub tm: Option<&'static str>,
    pub is_hook: bool,
    pub tailcalls: u32,
}
Expand description

An activation record on a thread’s call stack. Pure data (closure handle + stack offsets), so it lives in runtime where the GC can trace a suspended coroutine’s frames.

Fields§

§closure: Gc<LuaClosure>

Currently executing closure.

§base: u32

stack index of register 0

§pc: u32

Program counter (index into closure.proto.code).

§func_slot: u32

stack slot of the function (results land here)

§n_varargs: u32

number of extra (vararg) arguments, living on the stack just below base at func_slot+1 .. func_slot+1+n_varargs (PUC CallInfo.u.l.nextraargs). OP_VARARG/OP_VARGIDX read them there; a named vararg only materializes a heap table when it is written / escapes / is _ENV.

§nresults: i32

results expected by the caller (-1 = all)

§hook_oldpc: u32

pc the line hook last observed in this frame (PUC CallInfo oldpc); u32::MAX on a fresh frame so its first instruction fires a line event

§from_c: bool

true if this Lua frame was entered across a C boundary (call_value: a metamethod, pcall, __close handler, or a coroutine body). Debug level traversal (debug.getinfo/traceback) inserts a synthetic C frame below it.

§tm: Option<&'static str>

the metamethod event this frame is handling (e.g. “close” for a __close handler call), so debug.traceback/getinfo can name it “metamethod ‘close’” (PUC CallInfo.u.l.tm/luaG_funcnamefromtm).

§is_hook: bool

true when this frame is the hook function itself (PUC sets CIST_HOOKED). debug.getinfo(1).namewhat returns "hook" for it.

§tailcalls: u32

PUC ci->u.l.tailcalls — how many tail calls have collapsed into this activation slot. Each OP_TailCall chain adds one. 5.1 lua_getstack reports a synthetic CIST_TAIL level per count (so a deeply tail-recursive function shows tailcalls extra levels between itself and its real caller — 5.1 db.lua :372 walks getinfo(2..lim) and expects each to be "tail"). The 5.2+ istailcall boolean is tailcalls > 0.

Trait Implementations§

Source§

impl Clone for Frame

Source§

fn clone(&self) -> Frame

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Frame

Auto Trait Implementations§

§

impl !RefUnwindSafe for Frame

§

impl !Send for Frame

§

impl !Sync for Frame

§

impl !UnwindSafe for Frame

§

impl Freeze for Frame

§

impl Unpin for Frame

§

impl UnsafeUnpin for Frame

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.