Lua.Compiler.Prototype (Lua v1.0.0-rc.0)

View Source

Represents a compiled Lua function prototype.

This is the unit of compilation - each Lua function compiles to a prototype containing its instructions, nested function prototypes, and upvalue descriptors.

Summary

Functions

Creates a new prototype with the given options.

Types

instruction()

@type instruction() :: tuple()

t()

@type t() :: %Lua.Compiler.Prototype{
  bytecode: tuple() | nil,
  instructions: [instruction()],
  is_vararg: boolean(),
  lines: {non_neg_integer(), non_neg_integer()},
  max_registers: non_neg_integer(),
  param_count: non_neg_integer(),
  prototypes: [t()],
  source: binary(),
  upvalue_descriptors: [upvalue_descriptor()],
  varargs: term()
}

upvalue_descriptor()

@type upvalue_descriptor() ::
  {:parent_register, register_index :: non_neg_integer()}
  | {:parent_upvalue, upvalue_index :: non_neg_integer()}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Creates a new prototype with the given options.