[..] Module – luajit

Module luajit provides bindings for the LuaJIT C library (2.1.1744318430)

#import "jc/ext/luajit";

Index

Constants (97)

Procedures (149)

Types (13)

Imports (1)

Constants

Integer

Integer :: ptrdiff_t;

LUAI_GCMUL

LUAI_GCMUL :: 200;

LUAI_GCPAUSE

LUAI_GCPAUSE :: 200;

LUAI_MAXCSTACK

LUAI_MAXCSTACK :: 8000;

LUAI_MAXNUMBER2STR

LUAI_MAXNUMBER2STR :: 32;

LUAI_MAXSTACK

LUAI_MAXSTACK :: 65500;
LUAJIT_COPYRIGHT :: "Copyright (C) 2005-2025 Mike Pall";

LUAJIT_MODE_FLUSH

LUAJIT_MODE_FLUSH :: 0x0200;

LUAJIT_MODE_MASK

LUAJIT_MODE_MASK :: 0x00ff;

LUAJIT_MODE_OFF

LUAJIT_MODE_OFF :: 0x0000;

LUAJIT_MODE_ON

LUAJIT_MODE_ON :: 0x0100;

LUAJIT_URL

LUAJIT_URL :: "https://luajit.org/";

LUAJIT_VERSION

LUAJIT_VERSION :: "LuaJIT 2.1.1744318430";

LUAJIT_VERSION_NUM

LUAJIT_VERSION_NUM :: 20199;

LUAJIT_VERSION_SYM

LUAJIT_VERSION_SYM :: JIT_version_2_1_1744318430;

LUA_AUTHORS

LUA_AUTHORS :: "R. Ierusalimschy, L. H. de Figueiredo & W. Celes";

LUA_BITLIBNAME

LUA_BITLIBNAME :: "bit";

LUA_COLIBNAME

LUA_COLIBNAME :: "coroutine";
LUA_COPYRIGHT :: "Copyright (C) 1994-2008 Lua.org, PUC-Rio";

LUA_CPATH

LUA_CPATH :: "LUA_CPATH";

LUA_DBLIBNAME

LUA_DBLIBNAME :: "debug";

LUA_DIRSEP

LUA_DIRSEP :: "/";

LUA_ENVIRONINDEX

LUA_ENVIRONINDEX :: -10001;

LUA_ERRERR

LUA_ERRERR :: 5;

LUA_ERRFILE

LUA_ERRFILE :: LUA_ERRERR+1;

LUA_ERRMEM

LUA_ERRMEM :: 4;

LUA_ERRRUN

LUA_ERRRUN :: 2;

LUA_ERRSYNTAX

LUA_ERRSYNTAX :: 3;

LUA_EXECDIR

LUA_EXECDIR :: "!";

LUA_FFILIBNAME

LUA_FFILIBNAME :: "ffi";

LUA_FILEHANDLE

LUA_FILEHANDLE :: "FILE*";

LUA_GCCOLLECT

LUA_GCCOLLECT :: 2;

LUA_GCCOUNT

LUA_GCCOUNT :: 3;

LUA_GCCOUNTB

LUA_GCCOUNTB :: 4;

LUA_GCISRUNNING

LUA_GCISRUNNING :: 9;

LUA_GCRESTART

LUA_GCRESTART :: 1;

LUA_GCSETPAUSE

LUA_GCSETPAUSE :: 6;

LUA_GCSETSTEPMUL

LUA_GCSETSTEPMUL :: 7;

LUA_GCSTEP

LUA_GCSTEP :: 5;

LUA_GCSTOP

LUA_GCSTOP :: 0;

LUA_GLOBALSINDEX

LUA_GLOBALSINDEX :: -10002;

LUA_HOOKCALL

LUA_HOOKCALL :: 0;

LUA_HOOKCOUNT

LUA_HOOKCOUNT :: 3;

LUA_HOOKLINE

LUA_HOOKLINE :: 2;

LUA_HOOKRET

LUA_HOOKRET :: 1;

LUA_HOOKTAILRET

LUA_HOOKTAILRET :: 4;

LUA_IDSIZE

LUA_IDSIZE :: 60;

LUA_IGMARK

LUA_IGMARK :: "-";

LUA_INIT

LUA_INIT :: "LUA_INIT";

LUA_INTFRMLEN

LUA_INTFRMLEN :: "l";

LUA_IOLIBNAME

LUA_IOLIBNAME :: "io";

LUA_JITLIBNAME

LUA_JITLIBNAME :: "jit";

LUA_JROOT

LUA_JROOT :: LUA_LROOT;

LUA_LMULTILIB

LUA_LMULTILIB :: "lib";

LUA_LOADLIBNAME

LUA_LOADLIBNAME :: "package";

LUA_LROOT

LUA_LROOT :: "/usr/local";

LUA_LUADIR

LUA_LUADIR :: "/lua/5.1/";

LUA_MASKCALL

LUA_MASKCALL :: 1 << LUA_HOOKCALL;

LUA_MASKCOUNT

LUA_MASKCOUNT :: 1 << LUA_HOOKCOUNT;

LUA_MASKLINE

LUA_MASKLINE :: 1 << LUA_HOOKLINE;

LUA_MASKRET

LUA_MASKRET :: 1 << LUA_HOOKRET;

LUA_MATHLIBNAME

LUA_MATHLIBNAME :: "math";

LUA_MAXCAPTURES

LUA_MAXCAPTURES :: 32;

LUA_MINSTACK

LUA_MINSTACK :: 20;

LUA_MULTILIB

LUA_MULTILIB :: "lib";

LUA_MULTRET

LUA_MULTRET :: -1;

LUA_NOREF

LUA_NOREF :: -2;

LUA_NUMBER_FMT

LUA_NUMBER_FMT :: "%.14g";

LUA_NUMBER_SCAN

LUA_NUMBER_SCAN :: "%lf";

LUA_OK

LUA_OK :: 0;

LUA_OSLIBNAME

LUA_OSLIBNAME :: "os";

LUA_PATH

LUA_PATH :: "LUA_PATH";

LUA_PATHSEP

LUA_PATHSEP :: ";";

LUA_PATH_MARK

LUA_PATH_MARK :: "?";

LUA_REFNIL

LUA_REFNIL :: -1;

LUA_REGISTRYINDEX

LUA_REGISTRYINDEX :: -10000;

LUA_RELEASE

LUA_RELEASE :: "Lua 5.1.4";

LUA_SIGNATURE

LUA_SIGNATURE :: "\033Lua";

LUA_STRLIBNAME

LUA_STRLIBNAME :: "string";

LUA_TABLIBNAME

LUA_TABLIBNAME :: "table";

LUA_TBOOLEAN

LUA_TBOOLEAN :: 1;

LUA_TFUNCTION

LUA_TFUNCTION :: 6;

LUA_TLIGHTUSERDATA

LUA_TLIGHTUSERDATA :: 2;

LUA_TNIL

LUA_TNIL :: 0;

LUA_TNONE

LUA_TNONE :: -1;

LUA_TNUMBER

LUA_TNUMBER :: 3;

LUA_TSTRING

LUA_TSTRING :: 4;

LUA_TTABLE

LUA_TTABLE :: 5;

LUA_TTHREAD

LUA_TTHREAD :: 8;

LUA_TUSERDATA

LUA_TUSERDATA :: 7;

LUA_VERSION

LUA_VERSION :: "Lua 5.1";

LUA_VERSION_NUM

LUA_VERSION_NUM :: 501;

LUA_YIELD

LUA_YIELD :: 1;

STATIC

STATIC :: true;

WINVER

WINVER :: 0x0501;

lua_Chunkreader

lua_Chunkreader :: Reader;

lua_Chunkwriter

lua_Chunkwriter :: Writer;

Procedures

JIT_profile_dumpstack

JIT_profile_dumpstack :: (L: *State, fmt: *u8, depth: s32, len: *u64) -> *u8

JIT_profile_start

JIT_profile_start :: (L: *State, mode: *u8, cb: JIT_profile_callback, data: *void)

JIT_profile_stop

JIT_profile_stop :: (L: *State)

JIT_setmode

JIT_setmode :: (L: *State, idx: s32, mode: s32) -> s32

JIT_version_2_1_1744318430

JIT_version_2_1_1744318430 :: ()

L_addlstring

L_addlstring :: (B: *L_Buffer, s: *u8, l: u64)

L_addstring

L_addstring :: (B: *L_Buffer, s: *u8)

L_addvalue

L_addvalue :: (B: *L_Buffer)

L_argerror

L_argerror :: (L: *State, numarg: s32, extramsg: *u8) -> s32

L_buffinit

L_buffinit :: (L: *State, B: *L_Buffer)

L_callmeta

L_callmeta :: (L: *State, obj: s32, e: *u8) -> s32

L_checkany

L_checkany :: (L: *State, narg: s32)

L_checkinteger

L_checkinteger :: (L: *State, numArg: s32) -> Integer

L_checklstring

L_checklstring :: (L: *State, numArg: s32, l: *u64) -> *u8

L_checknumber

L_checknumber :: (L: *State, numArg: s32) -> Number

L_checkoption

L_checkoption :: (L: *State, narg: s32, def: *u8, lst: **u8) -> s32

L_checkstack

L_checkstack :: (L: *State, sz: s32, msg: *u8)

L_checktype

L_checktype :: (L: *State, narg: s32, t: s32)

L_checkudata

L_checkudata :: (L: *State, ud: s32, tname: *u8) -> *void

L_error

L_error :: (L: *State, fmt: string, __args: ..Any) -> s32

L_error_CFormat

L_error_CFormat :: (L: *State, fmt: *u8, __args: ..Any) -> s32

L_execresult

L_execresult :: (L: *State, stat: s32) -> s32

L_fileresult

L_fileresult :: (L: *State, stat: s32, fname: *u8) -> s32

L_findtable

L_findtable :: (L: *State, idx: s32, fname: *u8, szhint: s32) -> *u8

L_getmetafield

L_getmetafield :: (L: *State, obj: s32, e: *u8) -> s32

L_gsub

L_gsub :: (L: *State, s: *u8, p: *u8, r: *u8) -> *u8

L_loadbuffer

L_loadbuffer :: (L: *State, buff: *u8, sz: u64, name: *u8) -> s32

L_loadbufferx

L_loadbufferx :: (L: *State, buff: *u8, sz: u64, name: *u8, mode: *u8) -> s32

L_loadfile

L_loadfile :: (L: *State, filename: *u8) -> s32

L_loadfilex

L_loadfilex :: (L: *State, filename: *u8, mode: *u8) -> s32

L_loadstring

L_loadstring :: (L: *State, s: *u8) -> s32

L_newmetatable

L_newmetatable :: (L: *State, tname: *u8) -> s32

L_newstate

L_newstate :: () -> *State

L_openlib

L_openlib :: (L: *State, libname: *u8, l: *L_Reg, nup: s32)

L_openlibs

L_openlibs :: (L: *State)

L_optinteger

L_optinteger :: (L: *State, nArg: s32, def: Integer) -> Integer

L_optlstring

L_optlstring :: (L: *State, numArg: s32, def: *u8, l: *u64) -> *u8

L_optnumber

L_optnumber :: (L: *State, nArg: s32, def: Number) -> Number

L_prepbuffer

L_prepbuffer :: (B: *L_Buffer) -> *u8

L_pushmodule

L_pushmodule :: (L: *State, modname: *u8, sizehint: s32)

L_pushresult

L_pushresult :: (B: *L_Buffer)

L_ref

L_ref :: (L: *State, t: s32) -> s32

L_register

L_register :: (L: *State, libname: *u8, l: *L_Reg)

L_setfuncs

L_setfuncs :: (L: *State, l: *L_Reg, nup: s32)

L_setmetatable

L_setmetatable :: (L: *State, tname: *u8)

L_testudata

L_testudata :: (L: *State, ud: s32, tname: *u8) -> *void

L_traceback

L_traceback :: (L: *State, L1: *State, msg: *u8, level: s32)

L_typerror

L_typerror :: (L: *State, narg: s32, tname: *u8) -> s32

L_unref

L_unref :: (L: *State, t: s32, ref: s32)

L_where

L_where :: (L: *State, lvl: s32)

atpanic

atpanic :: (L: *State, panicf: CFunction) -> CFunction

call

call :: (L: *State, nargs: s32, nresults: s32)

checkstack

checkstack :: (L: *State, sz: s32) -> s32

close

close :: (L: *State)

concat

concat :: (L: *State, n: s32)

copy

copy :: (L: *State, fromidx: s32, toidx: s32)

cpcall

cpcall :: (L: *State, func: CFunction, ud: *void) -> s32

createtable

createtable :: (L: *State, narr: s32, nrec: s32)

dump

dump :: (L: *State, writer: Writer, data: *void) -> s32

equal

equal :: (L: *State, idx1: s32, idx2: s32) -> s32

error

error :: (L: *State) -> s32

gc

gc :: (L: *State, what: s32, data: s32) -> s32

getallocf

getallocf :: (L: *State, ud: **void) -> Alloc

getfenv

getfenv :: (L: *State, idx: s32)

getfield

getfield :: (L: *State, idx: s32, k: *u8)

gethook

gethook :: (L: *State) -> Hook

gethookcount

gethookcount :: (L: *State) -> s32

gethookmask

gethookmask :: (L: *State) -> s32

getinfo

getinfo :: (L: *State, what: *u8, ar: *Debug) -> s32

getlocal

getlocal :: (L: *State, ar: *Debug, n: s32) -> *u8

getmetatable

getmetatable :: (L: *State, objindex: s32) -> s32

getstack

getstack :: (L: *State, level: s32, ar: *Debug) -> s32

gettable

gettable :: (L: *State, idx: s32)

gettop

gettop :: (L: *State) -> s32

getupvalue

getupvalue :: (L: *State, funcindex: s32, n: s32) -> *u8

insert

insert :: (L: *State, idx: s32)

iscfunction

iscfunction :: (L: *State, idx: s32) -> s32

isnumber

isnumber :: (L: *State, idx: s32) -> s32

isstring

isstring :: (L: *State, idx: s32) -> s32

isuserdata

isuserdata :: (L: *State, idx: s32) -> s32

isyieldable

isyieldable :: (L: *State) -> s32

lessthan

lessthan :: (L: *State, idx1: s32, idx2: s32) -> s32

load

load :: (L: *State, reader: Reader, dt: *void, chunkname: *u8) -> s32

loadx

loadx :: (L: *State, reader: Reader, dt: *void, chunkname: *u8, mode: *u8) -> s32

newstate

newstate :: (f: Alloc, ud: *void) -> *State

newthread

newthread :: (L: *State) -> *State

newuserdata

newuserdata :: (L: *State, sz: u64) -> *void

next

next :: (L: *State, idx: s32) -> s32

objlen

objlen :: (L: *State, idx: s32) -> u64

open_base

open_base :: (L: *State) -> s32

open_bit

open_bit :: (L: *State) -> s32

open_debug

open_debug :: (L: *State) -> s32

open_ffi

open_ffi :: (L: *State) -> s32

open_io

open_io :: (L: *State) -> s32

open_jit

open_jit :: (L: *State) -> s32

open_math

open_math :: (L: *State) -> s32

open_os

open_os :: (L: *State) -> s32

open_package

open_package :: (L: *State) -> s32

open_string

open_string :: (L: *State) -> s32

open_string_buffer

open_string_buffer :: (L: *State) -> s32

open_table

open_table :: (L: *State) -> s32

operator_remove

operator_remove :: (L: *State, idx: s32)

pcall

pcall :: (L: *State, nargs: s32, nresults: s32, errfunc: s32) -> s32

pushboolean

pushboolean :: (L: *State, b: s32)

pushcclosure

pushcclosure :: (L: *State, fn: CFunction, n: s32)

pushfstring

pushfstring :: (L: *State, fmt: string, __args: ..Any) -> *u8

pushfstring_CFormat

pushfstring_CFormat :: (L: *State, fmt: *u8, __args: ..Any) -> *u8

pushinteger

pushinteger :: (L: *State, n: Integer)

pushlightuserdata

pushlightuserdata :: (L: *State, p: *void)

pushlstring

pushlstring :: (L: *State, s: *u8, l: u64)

pushnil

pushnil :: (L: *State)

pushnumber

pushnumber :: (L: *State, n: Number)

pushstring

pushstring :: (L: *State, s: *u8)

pushthread

pushthread :: (L: *State) -> s32

pushvalue

pushvalue :: (L: *State, idx: s32)

rawequal

rawequal :: (L: *State, idx1: s32, idx2: s32) -> s32

rawget

rawget :: (L: *State, idx: s32)

rawgeti

rawgeti :: (L: *State, idx: s32, n: s32)

rawset

rawset :: (L: *State, idx: s32)

rawseti

rawseti :: (L: *State, idx: s32, n: s32)

replace

replace :: (L: *State, idx: s32)

resume

resume :: (L: *State, narg: s32) -> s32

setallocf

setallocf :: (L: *State, f: Alloc, ud: *void)

setfenv

setfenv :: (L: *State, idx: s32) -> s32

setfield

setfield :: (L: *State, idx: s32, k: *u8)

sethook

sethook :: (L: *State, func: Hook, mask: s32, count: s32) -> s32

setlocal

setlocal :: (L: *State, ar: *Debug, n: s32) -> *u8

setmetatable

setmetatable :: (L: *State, objindex: s32) -> s32

settable

settable :: (L: *State, idx: s32)

settop

settop :: (L: *State, idx: s32)

setupvalue

setupvalue :: (L: *State, funcindex: s32, n: s32) -> *u8

status

status :: (L: *State) -> s32

toboolean

toboolean :: (L: *State, idx: s32) -> s32

tocfunction

tocfunction :: (L: *State, idx: s32) -> CFunction

tointeger

tointeger :: (L: *State, idx: s32) -> Integer

tointegerx

tointegerx :: (L: *State, idx: s32, isnum: *s32) -> Integer

tolstring

tolstring :: (L: *State, idx: s32, len: *u64) -> *u8

tonumber

tonumber :: (L: *State, idx: s32) -> Number

tonumberx

tonumberx :: (L: *State, idx: s32, isnum: *s32) -> Number

topointer

topointer :: (L: *State, idx: s32) -> *void

tothread

tothread :: (L: *State, idx: s32) -> *State

touserdata

touserdata :: (L: *State, idx: s32) -> *void

type

type :: (L: *State, idx: s32) -> s32

typename

typename :: (L: *State, tp: s32) -> *u8

upvalueid

upvalueid :: (L: *State, idx: s32, n: s32) -> *void

upvaluejoin

upvaluejoin :: (L: *State, idx1: s32, n1: s32, idx2: s32, n2: s32)

version

version :: (L: *State) -> *Number

xmove

xmove :: (from: *State, to: *State, n: s32)

yield

yield :: (L: *State, nresults: s32) -> s32

Macros

This section is empty.

Types

Alloc

Alloc :: #type (ud: *void, ptr: *void, osize: u64, nsize: u64) -> *void #c_call;

CFunction

CFunction :: #type (L: *State) -> s32 #c_call;

Debug

Debug :: struct {
    event:           s32;
    name:            *u8; /* (n) */
    namewhat:        *u8; /* (n) `global', `local', `field', `method' */
    what:            *u8; /* (S) `Lua', `C', `main', `tail' */
    source:          *u8; /* (S) */
    currentline:     s32; /* (l) */
    nups:            s32; /* (u) number of upvalues */
    linedefined:     s32; /* (S) */
    lastlinedefined: s32; /* (S) */
    short_src:       [60] u8; /* (S) */

    i_ci:            s32; /* active function */
}

Hook

Hook :: #type (L: *State, ar: *Debug) -> void #c_call;

JIT_profile_callback

JIT_profile_callback :: #type (data: *void, L: *State, samples: s32, vmstate: s32) -> void #c_call;

LUAJIT_MODE

LUAJIT_MODE :: enum u32 {
    ENGINE     :: 0;
    DEBUG      :: 1;

    FUNC       :: 2;
    ALLFUNC    :: 3;
    ALLSUBFUNC :: 4;

    TRACE      :: 5;

    WRAPCFUNC  :: 16;

    MAX        :: 17;

    LUAJIT_MODE_ENGINE     :: ENGINE;
    LUAJIT_MODE_DEBUG      :: DEBUG;

    LUAJIT_MODE_FUNC       :: FUNC;
    LUAJIT_MODE_ALLFUNC    :: ALLFUNC;
    LUAJIT_MODE_ALLSUBFUNC :: ALLSUBFUNC;

    LUAJIT_MODE_TRACE      :: TRACE;

    LUAJIT_MODE_WRAPCFUNC  :: WRAPCFUNC;

    LUAJIT_MODE_MAX        :: MAX;
}

L_Buffer

L_Buffer :: struct {
    p:      *u8; /* current position in buffer */
    lvl:    s32; /* number of strings in the stack (level) */
    L:      *State;
    buffer: [1024] u8;
}

L_Reg

L_Reg :: struct {
    name: *u8;
    func: CFunction;
}

Number

Number :: float64;

Reader

Reader :: #type (L: *State, ud: *void, sz: *u64) -> *u8 #c_call;

State

State :: struct {}

Writer

Writer :: #type (L: *State, p: *void, sz: u64, ud: *void) -> s32 #c_call;

ptrdiff_t

ptrdiff_t :: s64;