lunacy

Types

ValidLuaType = range[low(LuaType).succ .. LuaType.high]
LuaStackAddress = object
  L: PState
  address: LuaStackAddressValue
LuaStack = ref object
  comment*: string
  pos*: LuaStackAddress
  case kind*: LuaType
  of TInvalid:
      nil

  of TNone:
      nil

  of TNil:
      nil

  of TBoolean:
      truthy*: bool

  of TString:
      str*: string

  of TNumber:
      num*: float

  of TLightUserData:
      data*: string

  of TTable:
      tab*: TableRef[LuaStack, LuaStack]

  of TUserData:
      user*: string

  of TThread:
      thread*: string

  of TFunction:
      funny*: proc ()

  

Procs

proc clean(s: LuaStack): bool {...}{.raises: [], tags: [].}
proc hash(tab: TableRef[LuaStack, LuaStack]): Hash {...}{.raises: [Exception],
    tags: [RootEffect].}
proc hash(s: LuaStack): Hash {...}{.raises: [Exception], tags: [RootEffect].}
proc `==`(a, b: LuaStack): bool {...}{.raises: [Exception], tags: [RootEffect].}
proc `$`(a: LuaStackAddress): string {...}{.raises: [ValueError], tags: [].}
proc read(s: LuaStack) {...}{.raises: [Exception, ValueError], tags: [RootEffect].}
proc read[T: LuaStack](s: T; index: cint): T
proc pop[T: LuaStack](s: T): T
proc pop[T: LuaStack](s: var T): T
pop the value off the stack and return it
proc toTable[T: LuaStack](s: var T): TableRef[T, T]
pull a lua table off the stack and into a stack object
proc read(s: var LuaStack) {...}{.raises: [Exception], tags: [RootEffect].}
proc len(s: LuaStack): int {...}{.raises: [Exception, ValueError], tags: [RootEffect].}
proc `$`(s: LuaStack): string {...}{.raises: [Exception, ValueError], tags: [RootEffect].}
proc newLuaStack(kind: ValidLuaType; n: float): LuaStack {...}{.raises: [ValueError],
    tags: [].}
proc newLuaStack(kind: ValidLuaType; s: string): LuaStack {...}{.raises: [ValueError],
    tags: [].}
proc newLuaStack(kind: ValidLuaType; pos: LuaStackAddress): LuaStack {...}{.
    raises: [ValueError], tags: [].}
proc newLuaStack(kind: ValidLuaType; address: SomeNumber): LuaStack
proc last(L: PState): LuaStackAddress {...}{.raises: [], tags: [].}
proc last(s: LuaStack): LuaStack {...}{.raises: [ValueError], tags: [].}
proc contains(s: LuaStack; i: LuaStack): bool {...}{.raises: [Exception, ValueError],
    tags: [RootEffect].}
proc contains(s: LuaStack; i: string): bool {...}{.raises: [Exception, ValueError],
                                        tags: [RootEffect].}
proc contains(t: TableRef[LuaStack, LuaStack]; s: LuaStack): bool {...}{.
    raises: [Exception], tags: [RootEffect].}
proc `[]`(s: LuaStack; index: LuaStack): LuaStack {...}{.
    raises: [Exception, KeyError, ValueError], tags: [RootEffect].}
proc `[]`(s: LuaStack; index: string): LuaStack {...}{.
    raises: [Exception, ValueError, KeyError], tags: [RootEffect].}

Iterators

iterator pairs(s: LuaStack): tuple[key: LuaStack, val: LuaStack] {...}{.raises: [Exception],
    tags: [RootEffect].}
iterator values(s: LuaStack): LuaStack {...}{.raises: [Exception], tags: [RootEffect].}
iterator keys(s: LuaStack): LuaStack {...}{.raises: [Exception], tags: [RootEffect].}

Converters

converter toCint(si: int): cint {...}{.raises: [], tags: [].}

Macros

macro lua(ast: untyped): PState

Templates

template L(s: LuaStack): PState
template address(s: LuaStack): LuaStackAddressValue