diff --git a/.gitignore b/.gitignore index a035672f..097c530c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ target mat_data.txt save_state *png~ -/quant.ew/files/system/player/tmp/ \ No newline at end of file +/quant.ew/files/system/player/tmp/ +/quant.ew/ewext.dll \ No newline at end of file diff --git a/Justfile b/Justfile index 9caf20d7..ec212c14 100644 --- a/Justfile +++ b/Justfile @@ -13,26 +13,35 @@ build: cd noita-proxy && cargo build cd noita-proxy && cargo build --release -run-rel: add_dylib_release - cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 cargo run --release +## ewext stuff +build_luajit: + mkdir target/ -p + cd target && git clone https://luajit.org/git/luajit.git || true + cd target/luajit && git checkout v2.0.4 && make HOST_CC="gcc -m32" CROSS=i686-w64-mingw32- TARGET_SYS=Windows + cp target/luajit/src/ + bindgen ../target/luajit/src/lua.h -o src/lua_bindings.rs --dynamic-loading Lua51 --no-layout-tests -run-rel-alt: add_dylib_release +# `rustup target add i686-pc-windows-gnu` first +build_ext: + cd ewext && cargo build --release --target=i686-pc-windows-gnu + cp ewext/target/i686-pc-windows-gnu/release/ewext.dll quant.ew/ewext.dll + +## + +run-rel: add_dylib_release cd noita-proxy && NP_SKIP_MOD_CHECK=1 cargo run --release flamegraph: add_dylib_debug cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 cargo flamegraph -run: add_dylib_debug - cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 cargo run +run: add_dylib_debug build_ext + cd noita-proxy && NP_SKIP_MOD_CHECK=1 cargo run -run2: add_dylib_debug - cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21252 cargo run -- --launch-cmd "wine noita.exe -gamemode 0" +run2: add_dylib_debug build_ext + cd noita-proxy && NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21252 cargo run -- --launch-cmd "wine noita.exe -gamemode 0" -run2-alt: add_dylib_debug - cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21252 cargo run +run3: add_dylib_debug build_ext + cd noita-proxy && NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21253 cargo run -- --launch-cmd "wine noita.exe -gamemode 0" -run3: add_dylib_debug - cd noita-proxy && NP_APPID=480 NP_SKIP_MOD_CHECK=1 NP_NOITA_ADDR=127.0.0.1:21253 cargo run -- --launch-cmd "wine noita.exe -gamemode 0" - -release: build add_dylib_release +release: build_ext python scripts/prepare_release.py diff --git a/ewext/Cargo.lock b/ewext/Cargo.lock new file mode 100644 index 00000000..dd7576f2 --- /dev/null +++ b/ewext/Cargo.lock @@ -0,0 +1,90 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "ewext" +version = "0.1.0" +dependencies = [ + "libloading", +] + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/ewext/Cargo.toml b/ewext/Cargo.toml new file mode 100644 index 00000000..3355ddef --- /dev/null +++ b/ewext/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "ewext" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + + +[profile.release] +#lto = "thin" + +[dependencies] +libloading = "0.8.5" diff --git a/ewext/build.rs b/ewext/build.rs new file mode 100644 index 00000000..475f87c2 --- /dev/null +++ b/ewext/build.rs @@ -0,0 +1,3 @@ +fn main() { + // println!("cargo::rustc-link-lib=raw-dylib=lua"); +} diff --git a/ewext/src/lib.rs b/ewext/src/lib.rs new file mode 100644 index 00000000..08fb8fc9 --- /dev/null +++ b/ewext/src/lib.rs @@ -0,0 +1,28 @@ +use std::{ffi::c_int, sync::LazyLock}; + +use lua_bindings::{lua_State, Lua51, LUA_GLOBALSINDEX}; + +mod lua_bindings; + +static LUA: LazyLock = LazyLock::new(|| unsafe { + let lib = libloading::Library::new("./lua51.dll").expect("library to exist"); + Lua51::from_library(lib).expect("library to be lua") +}); + +// const EWEXT: [(&'static str, Function); 1] = [("testfn", None)]; + +extern "C" fn test_fn(lua: *mut lua_State) -> c_int { + 0 +} + +#[no_mangle] +pub extern "C" fn luaopen_ewext(lua: *mut lua_State) -> c_int { + println!("Initializing ewext"); + unsafe { + LUA.lua_pushcclosure(lua, Some(test_fn), 0); + LUA.lua_setfield(lua, LUA_GLOBALSINDEX, c"ewext".as_ptr()) + } + // let mut luastate = unsafe { State::from_ptr(luastateptr) }; + // luastate.new_lib(&EWEXT); + 1 +} diff --git a/ewext/src/lua_bindings.rs b/ewext/src/lua_bindings.rs new file mode 100644 index 00000000..6a3f5de3 --- /dev/null +++ b/ewext/src/lua_bindings.rs @@ -0,0 +1,1674 @@ +/* automatically generated by rust-bindgen 0.70.0 */ + +#![allow(non_upper_case_globals)] +#![allow(dead_code)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +pub const WINVER: u32 = 1281; +pub const _LIBC_LIMITS_H_: u32 = 1; +pub const _FEATURES_H: u32 = 1; +pub const _DEFAULT_SOURCE: u32 = 1; +pub const __GLIBC_USE_ISOC23: u32 = 0; +pub const __USE_ISOC11: u32 = 1; +pub const __USE_ISOC99: u32 = 1; +pub const __USE_ISOC95: u32 = 1; +pub const __USE_POSIX_IMPLICITLY: u32 = 1; +pub const _POSIX_SOURCE: u32 = 1; +pub const _POSIX_C_SOURCE: u32 = 200809; +pub const __USE_POSIX: u32 = 1; +pub const __USE_POSIX2: u32 = 1; +pub const __USE_POSIX199309: u32 = 1; +pub const __USE_POSIX199506: u32 = 1; +pub const __USE_XOPEN2K: u32 = 1; +pub const __USE_XOPEN2K8: u32 = 1; +pub const _ATFILE_SOURCE: u32 = 1; +pub const __WORDSIZE: u32 = 64; +pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; +pub const __SYSCALL_WORDSIZE: u32 = 64; +pub const __TIMESIZE: u32 = 64; +pub const __USE_TIME_BITS64: u32 = 1; +pub const __USE_MISC: u32 = 1; +pub const __USE_ATFILE: u32 = 1; +pub const __USE_FORTIFY_LEVEL: u32 = 0; +pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; +pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; +pub const __GLIBC_USE_C23_STRTOL: u32 = 0; +pub const _STDC_PREDEF_H: u32 = 1; +pub const __STDC_IEC_559__: u32 = 1; +pub const __STDC_IEC_60559_BFP__: u32 = 201404; +pub const __STDC_IEC_559_COMPLEX__: u32 = 1; +pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404; +pub const __STDC_ISO_10646__: u32 = 201706; +pub const __GNU_LIBRARY__: u32 = 6; +pub const __GLIBC__: u32 = 2; +pub const __GLIBC_MINOR__: u32 = 40; +pub const _SYS_CDEFS_H: u32 = 1; +pub const __glibc_c99_flexarr_available: u32 = 1; +pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; +pub const __HAVE_GENERIC_SELECTION: u32 = 1; +pub const __GLIBC_USE_LIB_EXT2: u32 = 0; +pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_BFP_EXT_C23: u32 = 0; +pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; +pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C23: u32 = 0; +pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; +pub const MB_LEN_MAX: u32 = 16; +pub const _BITS_POSIX1_LIM_H: u32 = 1; +pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; +pub const _POSIX_AIO_MAX: u32 = 1; +pub const _POSIX_ARG_MAX: u32 = 4096; +pub const _POSIX_CHILD_MAX: u32 = 25; +pub const _POSIX_DELAYTIMER_MAX: u32 = 32; +pub const _POSIX_HOST_NAME_MAX: u32 = 255; +pub const _POSIX_LINK_MAX: u32 = 8; +pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; +pub const _POSIX_MAX_CANON: u32 = 255; +pub const _POSIX_MAX_INPUT: u32 = 255; +pub const _POSIX_MQ_OPEN_MAX: u32 = 8; +pub const _POSIX_MQ_PRIO_MAX: u32 = 32; +pub const _POSIX_NAME_MAX: u32 = 14; +pub const _POSIX_NGROUPS_MAX: u32 = 8; +pub const _POSIX_OPEN_MAX: u32 = 20; +pub const _POSIX_PATH_MAX: u32 = 256; +pub const _POSIX_PIPE_BUF: u32 = 512; +pub const _POSIX_RE_DUP_MAX: u32 = 255; +pub const _POSIX_RTSIG_MAX: u32 = 8; +pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; +pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; +pub const _POSIX_SIGQUEUE_MAX: u32 = 32; +pub const _POSIX_SSIZE_MAX: u32 = 32767; +pub const _POSIX_STREAM_MAX: u32 = 8; +pub const _POSIX_SYMLINK_MAX: u32 = 255; +pub const _POSIX_SYMLOOP_MAX: u32 = 8; +pub const _POSIX_TIMER_MAX: u32 = 32; +pub const _POSIX_TTY_NAME_MAX: u32 = 9; +pub const _POSIX_TZNAME_MAX: u32 = 6; +pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; +pub const NR_OPEN: u32 = 1024; +pub const NGROUPS_MAX: u32 = 65536; +pub const ARG_MAX: u32 = 131072; +pub const LINK_MAX: u32 = 127; +pub const MAX_CANON: u32 = 255; +pub const MAX_INPUT: u32 = 255; +pub const NAME_MAX: u32 = 255; +pub const PATH_MAX: u32 = 4096; +pub const PIPE_BUF: u32 = 4096; +pub const XATTR_NAME_MAX: u32 = 255; +pub const XATTR_SIZE_MAX: u32 = 65536; +pub const XATTR_LIST_MAX: u32 = 65536; +pub const RTSIG_MAX: u32 = 32; +pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; +pub const PTHREAD_KEYS_MAX: u32 = 1024; +pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; +pub const AIO_PRIO_DELTA_MAX: u32 = 20; +pub const PTHREAD_STACK_MIN: u32 = 16384; +pub const DELAYTIMER_MAX: u32 = 2147483647; +pub const TTY_NAME_MAX: u32 = 32; +pub const LOGIN_NAME_MAX: u32 = 256; +pub const HOST_NAME_MAX: u32 = 64; +pub const MQ_PRIO_MAX: u32 = 32768; +pub const SEM_VALUE_MAX: u32 = 2147483647; +pub const _BITS_POSIX2_LIM_H: u32 = 1; +pub const _POSIX2_BC_BASE_MAX: u32 = 99; +pub const _POSIX2_BC_DIM_MAX: u32 = 2048; +pub const _POSIX2_BC_SCALE_MAX: u32 = 99; +pub const _POSIX2_BC_STRING_MAX: u32 = 1000; +pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; +pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; +pub const _POSIX2_LINE_MAX: u32 = 2048; +pub const _POSIX2_RE_DUP_MAX: u32 = 255; +pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; +pub const BC_BASE_MAX: u32 = 99; +pub const BC_DIM_MAX: u32 = 2048; +pub const BC_SCALE_MAX: u32 = 99; +pub const BC_STRING_MAX: u32 = 1000; +pub const COLL_WEIGHTS_MAX: u32 = 255; +pub const EXPR_NEST_MAX: u32 = 32; +pub const LINE_MAX: u32 = 2048; +pub const CHARCLASS_NAME_MAX: u32 = 2048; +pub const RE_DUP_MAX: u32 = 32767; +pub const LUA_MULTILIB: &[u8; 4] = b"lib\0"; +pub const LUA_LMULTILIB: &[u8; 4] = b"lib\0"; +pub const LUA_LROOT: &[u8; 11] = b"/usr/local\0"; +pub const LUA_LUADIR: &[u8; 10] = b"/lua/5.1/\0"; +pub const LUA_LJDIR: &[u8; 15] = b"/luajit-2.0.4/\0"; +pub const LUA_JROOT: &[u8; 11] = b"/usr/local\0"; +pub const LUA_JPATH: &[u8; 37] = b";/usr/local/share/luajit-2.0.4/?.lua\0"; +pub const LUA_LLDIR: &[u8; 26] = b"/usr/local/share/lua/5.1/\0"; +pub const LUA_LCDIR: &[u8; 24] = b"/usr/local/lib/lua/5.1/\0"; +pub const LUA_LLPATH: &[u8; 68] = + b";/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua\0"; +pub const LUA_LCPATH1: &[u8; 29] = b";/usr/local/lib/lua/5.1/?.so\0"; +pub const LUA_LCPATH2: &[u8; 35] = b";/usr/local/lib/lua/5.1/loadall.so\0"; +pub const LUA_PATH: &[u8; 9] = b"LUA_PATH\0"; +pub const LUA_CPATH: &[u8; 10] = b"LUA_CPATH\0"; +pub const LUA_INIT: &[u8; 9] = b"LUA_INIT\0"; +pub const LUA_DIRSEP: &[u8; 2] = b"/\0"; +pub const LUA_PATHSEP: &[u8; 2] = b";\0"; +pub const LUA_PATH_MARK: &[u8; 2] = b"?\0"; +pub const LUA_EXECDIR: &[u8; 2] = b"!\0"; +pub const LUA_IGMARK: &[u8; 2] = b"-\0"; +pub const LUA_PATH_CONFIG: &[u8; 10] = b"/\n;\n?\n!\n-\0"; +pub const LUAI_MAXSTACK: u32 = 65500; +pub const LUAI_MAXCSTACK: u32 = 8000; +pub const LUAI_GCPAUSE: u32 = 200; +pub const LUAI_GCMUL: u32 = 200; +pub const LUA_MAXCAPTURES: u32 = 32; +pub const LUA_IDSIZE: u32 = 60; +pub const LUA_NUMBER_SCAN: &[u8; 4] = b"%lf\0"; +pub const LUA_NUMBER_FMT: &[u8; 6] = b"%.14g\0"; +pub const LUAI_MAXNUMBER2STR: u32 = 32; +pub const LUA_INTFRMLEN: &[u8; 2] = b"l\0"; +pub const LUA_VERSION: &[u8; 8] = b"Lua 5.1\0"; +pub const LUA_RELEASE: &[u8; 10] = b"Lua 5.1.4\0"; +pub const LUA_VERSION_NUM: u32 = 501; +pub const LUA_COPYRIGHT: &[u8; 41] = b"Copyright (C) 1994-2008 Lua.org, PUC-Rio\0"; +pub const LUA_AUTHORS: &[u8; 49] = b"R. Ierusalimschy, L. H. de Figueiredo & W. Celes\0"; +pub const LUA_SIGNATURE: &[u8; 5] = b"\x1BLua\0"; +pub const LUA_MULTRET: i32 = -1; +pub const LUA_REGISTRYINDEX: i32 = -10000; +pub const LUA_ENVIRONINDEX: i32 = -10001; +pub const LUA_GLOBALSINDEX: i32 = -10002; +pub const LUA_YIELD: u32 = 1; +pub const LUA_ERRRUN: u32 = 2; +pub const LUA_ERRSYNTAX: u32 = 3; +pub const LUA_ERRMEM: u32 = 4; +pub const LUA_ERRERR: u32 = 5; +pub const LUA_TNONE: i32 = -1; +pub const LUA_TNIL: u32 = 0; +pub const LUA_TBOOLEAN: u32 = 1; +pub const LUA_TLIGHTUSERDATA: u32 = 2; +pub const LUA_TNUMBER: u32 = 3; +pub const LUA_TSTRING: u32 = 4; +pub const LUA_TTABLE: u32 = 5; +pub const LUA_TFUNCTION: u32 = 6; +pub const LUA_TUSERDATA: u32 = 7; +pub const LUA_TTHREAD: u32 = 8; +pub const LUA_MINSTACK: u32 = 20; +pub const LUA_GCSTOP: u32 = 0; +pub const LUA_GCRESTART: u32 = 1; +pub const LUA_GCCOLLECT: u32 = 2; +pub const LUA_GCCOUNT: u32 = 3; +pub const LUA_GCCOUNTB: u32 = 4; +pub const LUA_GCSTEP: u32 = 5; +pub const LUA_GCSETPAUSE: u32 = 6; +pub const LUA_GCSETSTEPMUL: u32 = 7; +pub const LUA_HOOKCALL: u32 = 0; +pub const LUA_HOOKRET: u32 = 1; +pub const LUA_HOOKLINE: u32 = 2; +pub const LUA_HOOKCOUNT: u32 = 3; +pub const LUA_HOOKTAILRET: u32 = 4; +pub const LUA_MASKCALL: u32 = 1; +pub const LUA_MASKRET: u32 = 2; +pub const LUA_MASKLINE: u32 = 4; +pub const LUA_MASKCOUNT: u32 = 8; +pub type __gnuc_va_list = __builtin_va_list; +pub type va_list = __builtin_va_list; +pub type wchar_t = ::std::os::raw::c_int; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_State { + _unused: [u8; 0], +} +pub type lua_CFunction = + ::std::option::Option ::std::os::raw::c_int>; +pub type lua_Reader = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + ud: *mut ::std::os::raw::c_void, + sz: *mut usize, + ) -> *const ::std::os::raw::c_char, +>; +pub type lua_Writer = ::std::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + p: *const ::std::os::raw::c_void, + sz: usize, + ud: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +pub type lua_Alloc = ::std::option::Option< + unsafe extern "C" fn( + ud: *mut ::std::os::raw::c_void, + ptr: *mut ::std::os::raw::c_void, + osize: usize, + nsize: usize, + ) -> *mut ::std::os::raw::c_void, +>; +pub type lua_Number = f64; +pub type lua_Integer = isize; +pub type lua_Hook = + ::std::option::Option; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lua_Debug { + pub event: ::std::os::raw::c_int, + pub name: *const ::std::os::raw::c_char, + pub namewhat: *const ::std::os::raw::c_char, + pub what: *const ::std::os::raw::c_char, + pub source: *const ::std::os::raw::c_char, + pub currentline: ::std::os::raw::c_int, + pub nups: ::std::os::raw::c_int, + pub linedefined: ::std::os::raw::c_int, + pub lastlinedefined: ::std::os::raw::c_int, + pub short_src: [::std::os::raw::c_char; 60usize], + pub i_ci: ::std::os::raw::c_int, +} +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +pub struct Lua51 { + __library: ::libloading::Library, + pub lua_newstate: Result< + unsafe extern "C" fn(f: lua_Alloc, ud: *mut ::std::os::raw::c_void) -> *mut lua_State, + ::libloading::Error, + >, + pub lua_close: Result, + pub lua_newthread: + Result *mut lua_State, ::libloading::Error>, + pub lua_atpanic: Result< + unsafe extern "C" fn(L: *mut lua_State, panicf: lua_CFunction) -> lua_CFunction, + ::libloading::Error, + >, + pub lua_gettop: Result< + unsafe extern "C" fn(L: *mut lua_State) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_settop: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_pushvalue: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_remove: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_insert: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_replace: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_checkstack: Result< + unsafe extern "C" fn(L: *mut lua_State, sz: ::std::os::raw::c_int) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_xmove: Result< + unsafe extern "C" fn(from: *mut lua_State, to: *mut lua_State, n: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_isnumber: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_isstring: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_iscfunction: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_isuserdata: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_type: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_typename: Result< + unsafe extern "C" fn( + L: *mut lua_State, + tp: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_equal: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_rawequal: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_lessthan: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_tonumber: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int) -> lua_Number, + ::libloading::Error, + >, + pub lua_tointeger: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int) -> lua_Integer, + ::libloading::Error, + >, + pub lua_toboolean: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_tolstring: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + len: *mut usize, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_objlen: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int) -> usize, + ::libloading::Error, + >, + pub lua_tocfunction: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int) -> lua_CFunction, + ::libloading::Error, + >, + pub lua_touserdata: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_void, + ::libloading::Error, + >, + pub lua_tothread: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int) -> *mut lua_State, + ::libloading::Error, + >, + pub lua_topointer: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_void, + ::libloading::Error, + >, + pub lua_pushnil: Result, + pub lua_pushnumber: + Result, + pub lua_pushinteger: + Result, + pub lua_pushlstring: Result< + unsafe extern "C" fn(L: *mut lua_State, s: *const ::std::os::raw::c_char, l: usize), + ::libloading::Error, + >, + pub lua_pushstring: Result< + unsafe extern "C" fn(L: *mut lua_State, s: *const ::std::os::raw::c_char), + ::libloading::Error, + >, + pub lua_pushvfstring: Result< + unsafe extern "C" fn( + L: *mut lua_State, + fmt: *const ::std::os::raw::c_char, + argp: *mut __va_list_tag, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_pushfstring: Result< + unsafe extern "C" fn( + L: *mut lua_State, + fmt: *const ::std::os::raw::c_char, + ... + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_pushcclosure: Result< + unsafe extern "C" fn(L: *mut lua_State, fn_: lua_CFunction, n: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_pushboolean: Result< + unsafe extern "C" fn(L: *mut lua_State, b: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_pushlightuserdata: Result< + unsafe extern "C" fn(L: *mut lua_State, p: *mut ::std::os::raw::c_void), + ::libloading::Error, + >, + pub lua_pushthread: Result< + unsafe extern "C" fn(L: *mut lua_State) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_gettable: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_getfield: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + k: *const ::std::os::raw::c_char, + ), + ::libloading::Error, + >, + pub lua_rawget: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_rawgeti: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ), + ::libloading::Error, + >, + pub lua_createtable: Result< + unsafe extern "C" fn( + L: *mut lua_State, + narr: ::std::os::raw::c_int, + nrec: ::std::os::raw::c_int, + ), + ::libloading::Error, + >, + pub lua_newuserdata: Result< + unsafe extern "C" fn(L: *mut lua_State, sz: usize) -> *mut ::std::os::raw::c_void, + ::libloading::Error, + >, + pub lua_getmetatable: Result< + unsafe extern "C" fn( + L: *mut lua_State, + objindex: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_getfenv: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_settable: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_setfield: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + k: *const ::std::os::raw::c_char, + ), + ::libloading::Error, + >, + pub lua_rawset: Result< + unsafe extern "C" fn(L: *mut lua_State, idx: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_rawseti: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ), + ::libloading::Error, + >, + pub lua_setmetatable: Result< + unsafe extern "C" fn( + L: *mut lua_State, + objindex: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_setfenv: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_call: Result< + unsafe extern "C" fn( + L: *mut lua_State, + nargs: ::std::os::raw::c_int, + nresults: ::std::os::raw::c_int, + ), + ::libloading::Error, + >, + pub lua_pcall: Result< + unsafe extern "C" fn( + L: *mut lua_State, + nargs: ::std::os::raw::c_int, + nresults: ::std::os::raw::c_int, + errfunc: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_cpcall: Result< + unsafe extern "C" fn( + L: *mut lua_State, + func: lua_CFunction, + ud: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_load: Result< + unsafe extern "C" fn( + L: *mut lua_State, + reader: lua_Reader, + dt: *mut ::std::os::raw::c_void, + chunkname: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_dump: Result< + unsafe extern "C" fn( + L: *mut lua_State, + writer: lua_Writer, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_yield: Result< + unsafe extern "C" fn( + L: *mut lua_State, + nresults: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_resume: Result< + unsafe extern "C" fn( + L: *mut lua_State, + narg: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_status: Result< + unsafe extern "C" fn(L: *mut lua_State) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_gc: Result< + unsafe extern "C" fn( + L: *mut lua_State, + what: ::std::os::raw::c_int, + data: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_error: Result< + unsafe extern "C" fn(L: *mut lua_State) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_next: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_concat: Result< + unsafe extern "C" fn(L: *mut lua_State, n: ::std::os::raw::c_int), + ::libloading::Error, + >, + pub lua_getallocf: Result< + unsafe extern "C" fn(L: *mut lua_State, ud: *mut *mut ::std::os::raw::c_void) -> lua_Alloc, + ::libloading::Error, + >, + pub lua_setallocf: Result< + unsafe extern "C" fn(L: *mut lua_State, f: lua_Alloc, ud: *mut ::std::os::raw::c_void), + ::libloading::Error, + >, + pub lua_setlevel: + Result, + pub lua_getstack: Result< + unsafe extern "C" fn( + L: *mut lua_State, + level: ::std::os::raw::c_int, + ar: *mut lua_Debug, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_getinfo: Result< + unsafe extern "C" fn( + L: *mut lua_State, + what: *const ::std::os::raw::c_char, + ar: *mut lua_Debug, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_getlocal: Result< + unsafe extern "C" fn( + L: *mut lua_State, + ar: *const lua_Debug, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_setlocal: Result< + unsafe extern "C" fn( + L: *mut lua_State, + ar: *const lua_Debug, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_getupvalue: Result< + unsafe extern "C" fn( + L: *mut lua_State, + funcindex: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_setupvalue: Result< + unsafe extern "C" fn( + L: *mut lua_State, + funcindex: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char, + ::libloading::Error, + >, + pub lua_sethook: Result< + unsafe extern "C" fn( + L: *mut lua_State, + func: lua_Hook, + mask: ::std::os::raw::c_int, + count: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_gethook: + Result lua_Hook, ::libloading::Error>, + pub lua_gethookmask: Result< + unsafe extern "C" fn(L: *mut lua_State) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_gethookcount: Result< + unsafe extern "C" fn(L: *mut lua_State) -> ::std::os::raw::c_int, + ::libloading::Error, + >, + pub lua_upvalueid: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_void, + ::libloading::Error, + >, + pub lua_upvaluejoin: Result< + unsafe extern "C" fn( + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + n1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + n2: ::std::os::raw::c_int, + ), + ::libloading::Error, + >, + pub lua_loadx: Result< + unsafe extern "C" fn( + L: *mut lua_State, + reader: lua_Reader, + dt: *mut ::std::os::raw::c_void, + chunkname: *const ::std::os::raw::c_char, + mode: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int, + ::libloading::Error, + >, +} +impl Lua51 { + pub unsafe fn new

(path: P) -> Result + where + P: AsRef<::std::ffi::OsStr>, + { + let library = ::libloading::Library::new(path)?; + Self::from_library(library) + } + pub unsafe fn from_library(library: L) -> Result + where + L: Into<::libloading::Library>, + { + let __library = library.into(); + let lua_newstate = __library.get(b"lua_newstate\0").map(|sym| *sym); + let lua_close = __library.get(b"lua_close\0").map(|sym| *sym); + let lua_newthread = __library.get(b"lua_newthread\0").map(|sym| *sym); + let lua_atpanic = __library.get(b"lua_atpanic\0").map(|sym| *sym); + let lua_gettop = __library.get(b"lua_gettop\0").map(|sym| *sym); + let lua_settop = __library.get(b"lua_settop\0").map(|sym| *sym); + let lua_pushvalue = __library.get(b"lua_pushvalue\0").map(|sym| *sym); + let lua_remove = __library.get(b"lua_remove\0").map(|sym| *sym); + let lua_insert = __library.get(b"lua_insert\0").map(|sym| *sym); + let lua_replace = __library.get(b"lua_replace\0").map(|sym| *sym); + let lua_checkstack = __library.get(b"lua_checkstack\0").map(|sym| *sym); + let lua_xmove = __library.get(b"lua_xmove\0").map(|sym| *sym); + let lua_isnumber = __library.get(b"lua_isnumber\0").map(|sym| *sym); + let lua_isstring = __library.get(b"lua_isstring\0").map(|sym| *sym); + let lua_iscfunction = __library.get(b"lua_iscfunction\0").map(|sym| *sym); + let lua_isuserdata = __library.get(b"lua_isuserdata\0").map(|sym| *sym); + let lua_type = __library.get(b"lua_type\0").map(|sym| *sym); + let lua_typename = __library.get(b"lua_typename\0").map(|sym| *sym); + let lua_equal = __library.get(b"lua_equal\0").map(|sym| *sym); + let lua_rawequal = __library.get(b"lua_rawequal\0").map(|sym| *sym); + let lua_lessthan = __library.get(b"lua_lessthan\0").map(|sym| *sym); + let lua_tonumber = __library.get(b"lua_tonumber\0").map(|sym| *sym); + let lua_tointeger = __library.get(b"lua_tointeger\0").map(|sym| *sym); + let lua_toboolean = __library.get(b"lua_toboolean\0").map(|sym| *sym); + let lua_tolstring = __library.get(b"lua_tolstring\0").map(|sym| *sym); + let lua_objlen = __library.get(b"lua_objlen\0").map(|sym| *sym); + let lua_tocfunction = __library.get(b"lua_tocfunction\0").map(|sym| *sym); + let lua_touserdata = __library.get(b"lua_touserdata\0").map(|sym| *sym); + let lua_tothread = __library.get(b"lua_tothread\0").map(|sym| *sym); + let lua_topointer = __library.get(b"lua_topointer\0").map(|sym| *sym); + let lua_pushnil = __library.get(b"lua_pushnil\0").map(|sym| *sym); + let lua_pushnumber = __library.get(b"lua_pushnumber\0").map(|sym| *sym); + let lua_pushinteger = __library.get(b"lua_pushinteger\0").map(|sym| *sym); + let lua_pushlstring = __library.get(b"lua_pushlstring\0").map(|sym| *sym); + let lua_pushstring = __library.get(b"lua_pushstring\0").map(|sym| *sym); + let lua_pushvfstring = __library.get(b"lua_pushvfstring\0").map(|sym| *sym); + let lua_pushfstring = __library.get(b"lua_pushfstring\0").map(|sym| *sym); + let lua_pushcclosure = __library.get(b"lua_pushcclosure\0").map(|sym| *sym); + let lua_pushboolean = __library.get(b"lua_pushboolean\0").map(|sym| *sym); + let lua_pushlightuserdata = __library.get(b"lua_pushlightuserdata\0").map(|sym| *sym); + let lua_pushthread = __library.get(b"lua_pushthread\0").map(|sym| *sym); + let lua_gettable = __library.get(b"lua_gettable\0").map(|sym| *sym); + let lua_getfield = __library.get(b"lua_getfield\0").map(|sym| *sym); + let lua_rawget = __library.get(b"lua_rawget\0").map(|sym| *sym); + let lua_rawgeti = __library.get(b"lua_rawgeti\0").map(|sym| *sym); + let lua_createtable = __library.get(b"lua_createtable\0").map(|sym| *sym); + let lua_newuserdata = __library.get(b"lua_newuserdata\0").map(|sym| *sym); + let lua_getmetatable = __library.get(b"lua_getmetatable\0").map(|sym| *sym); + let lua_getfenv = __library.get(b"lua_getfenv\0").map(|sym| *sym); + let lua_settable = __library.get(b"lua_settable\0").map(|sym| *sym); + let lua_setfield = __library.get(b"lua_setfield\0").map(|sym| *sym); + let lua_rawset = __library.get(b"lua_rawset\0").map(|sym| *sym); + let lua_rawseti = __library.get(b"lua_rawseti\0").map(|sym| *sym); + let lua_setmetatable = __library.get(b"lua_setmetatable\0").map(|sym| *sym); + let lua_setfenv = __library.get(b"lua_setfenv\0").map(|sym| *sym); + let lua_call = __library.get(b"lua_call\0").map(|sym| *sym); + let lua_pcall = __library.get(b"lua_pcall\0").map(|sym| *sym); + let lua_cpcall = __library.get(b"lua_cpcall\0").map(|sym| *sym); + let lua_load = __library.get(b"lua_load\0").map(|sym| *sym); + let lua_dump = __library.get(b"lua_dump\0").map(|sym| *sym); + let lua_yield = __library.get(b"lua_yield\0").map(|sym| *sym); + let lua_resume = __library.get(b"lua_resume\0").map(|sym| *sym); + let lua_status = __library.get(b"lua_status\0").map(|sym| *sym); + let lua_gc = __library.get(b"lua_gc\0").map(|sym| *sym); + let lua_error = __library.get(b"lua_error\0").map(|sym| *sym); + let lua_next = __library.get(b"lua_next\0").map(|sym| *sym); + let lua_concat = __library.get(b"lua_concat\0").map(|sym| *sym); + let lua_getallocf = __library.get(b"lua_getallocf\0").map(|sym| *sym); + let lua_setallocf = __library.get(b"lua_setallocf\0").map(|sym| *sym); + let lua_setlevel = __library.get(b"lua_setlevel\0").map(|sym| *sym); + let lua_getstack = __library.get(b"lua_getstack\0").map(|sym| *sym); + let lua_getinfo = __library.get(b"lua_getinfo\0").map(|sym| *sym); + let lua_getlocal = __library.get(b"lua_getlocal\0").map(|sym| *sym); + let lua_setlocal = __library.get(b"lua_setlocal\0").map(|sym| *sym); + let lua_getupvalue = __library.get(b"lua_getupvalue\0").map(|sym| *sym); + let lua_setupvalue = __library.get(b"lua_setupvalue\0").map(|sym| *sym); + let lua_sethook = __library.get(b"lua_sethook\0").map(|sym| *sym); + let lua_gethook = __library.get(b"lua_gethook\0").map(|sym| *sym); + let lua_gethookmask = __library.get(b"lua_gethookmask\0").map(|sym| *sym); + let lua_gethookcount = __library.get(b"lua_gethookcount\0").map(|sym| *sym); + let lua_upvalueid = __library.get(b"lua_upvalueid\0").map(|sym| *sym); + let lua_upvaluejoin = __library.get(b"lua_upvaluejoin\0").map(|sym| *sym); + let lua_loadx = __library.get(b"lua_loadx\0").map(|sym| *sym); + Ok(Lua51 { + __library, + lua_newstate, + lua_close, + lua_newthread, + lua_atpanic, + lua_gettop, + lua_settop, + lua_pushvalue, + lua_remove, + lua_insert, + lua_replace, + lua_checkstack, + lua_xmove, + lua_isnumber, + lua_isstring, + lua_iscfunction, + lua_isuserdata, + lua_type, + lua_typename, + lua_equal, + lua_rawequal, + lua_lessthan, + lua_tonumber, + lua_tointeger, + lua_toboolean, + lua_tolstring, + lua_objlen, + lua_tocfunction, + lua_touserdata, + lua_tothread, + lua_topointer, + lua_pushnil, + lua_pushnumber, + lua_pushinteger, + lua_pushlstring, + lua_pushstring, + lua_pushvfstring, + lua_pushfstring, + lua_pushcclosure, + lua_pushboolean, + lua_pushlightuserdata, + lua_pushthread, + lua_gettable, + lua_getfield, + lua_rawget, + lua_rawgeti, + lua_createtable, + lua_newuserdata, + lua_getmetatable, + lua_getfenv, + lua_settable, + lua_setfield, + lua_rawset, + lua_rawseti, + lua_setmetatable, + lua_setfenv, + lua_call, + lua_pcall, + lua_cpcall, + lua_load, + lua_dump, + lua_yield, + lua_resume, + lua_status, + lua_gc, + lua_error, + lua_next, + lua_concat, + lua_getallocf, + lua_setallocf, + lua_setlevel, + lua_getstack, + lua_getinfo, + lua_getlocal, + lua_setlocal, + lua_getupvalue, + lua_setupvalue, + lua_sethook, + lua_gethook, + lua_gethookmask, + lua_gethookcount, + lua_upvalueid, + lua_upvaluejoin, + lua_loadx, + }) + } + pub unsafe fn lua_newstate( + &self, + f: lua_Alloc, + ud: *mut ::std::os::raw::c_void, + ) -> *mut lua_State { + (self + .lua_newstate + .as_ref() + .expect("Expected function, got error."))(f, ud) + } + pub unsafe fn lua_close(&self, L: *mut lua_State) { + (self + .lua_close + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_newthread(&self, L: *mut lua_State) -> *mut lua_State { + (self + .lua_newthread + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_atpanic(&self, L: *mut lua_State, panicf: lua_CFunction) -> lua_CFunction { + (self + .lua_atpanic + .as_ref() + .expect("Expected function, got error."))(L, panicf) + } + pub unsafe fn lua_gettop(&self, L: *mut lua_State) -> ::std::os::raw::c_int { + (self + .lua_gettop + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_settop(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_settop + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_pushvalue(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_pushvalue + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_remove(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_remove + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_insert(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_insert + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_replace(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_replace + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_checkstack( + &self, + L: *mut lua_State, + sz: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_checkstack + .as_ref() + .expect("Expected function, got error."))(L, sz) + } + pub unsafe fn lua_xmove( + &self, + from: *mut lua_State, + to: *mut lua_State, + n: ::std::os::raw::c_int, + ) { + (self + .lua_xmove + .as_ref() + .expect("Expected function, got error."))(from, to, n) + } + pub unsafe fn lua_isnumber( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_isnumber + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_isstring( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_isstring + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_iscfunction( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_iscfunction + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_isuserdata( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_isuserdata + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_type( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_type + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_typename( + &self, + L: *mut lua_State, + tp: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char { + (self + .lua_typename + .as_ref() + .expect("Expected function, got error."))(L, tp) + } + pub unsafe fn lua_equal( + &self, + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_equal + .as_ref() + .expect("Expected function, got error."))(L, idx1, idx2) + } + pub unsafe fn lua_rawequal( + &self, + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_rawequal + .as_ref() + .expect("Expected function, got error."))(L, idx1, idx2) + } + pub unsafe fn lua_lessthan( + &self, + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_lessthan + .as_ref() + .expect("Expected function, got error."))(L, idx1, idx2) + } + pub unsafe fn lua_tonumber(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) -> lua_Number { + (self + .lua_tonumber + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_tointeger( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> lua_Integer { + (self + .lua_tointeger + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_toboolean( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_toboolean + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_tolstring( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + len: *mut usize, + ) -> *const ::std::os::raw::c_char { + (self + .lua_tolstring + .as_ref() + .expect("Expected function, got error."))(L, idx, len) + } + pub unsafe fn lua_objlen(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) -> usize { + (self + .lua_objlen + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_tocfunction( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> lua_CFunction { + (self + .lua_tocfunction + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_touserdata( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_void { + (self + .lua_touserdata + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_tothread( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> *mut lua_State { + (self + .lua_tothread + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_topointer( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_void { + (self + .lua_topointer + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_pushnil(&self, L: *mut lua_State) { + (self + .lua_pushnil + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_pushnumber(&self, L: *mut lua_State, n: lua_Number) { + (self + .lua_pushnumber + .as_ref() + .expect("Expected function, got error."))(L, n) + } + pub unsafe fn lua_pushinteger(&self, L: *mut lua_State, n: lua_Integer) { + (self + .lua_pushinteger + .as_ref() + .expect("Expected function, got error."))(L, n) + } + pub unsafe fn lua_pushlstring( + &self, + L: *mut lua_State, + s: *const ::std::os::raw::c_char, + l: usize, + ) { + (self + .lua_pushlstring + .as_ref() + .expect("Expected function, got error."))(L, s, l) + } + pub unsafe fn lua_pushstring(&self, L: *mut lua_State, s: *const ::std::os::raw::c_char) { + (self + .lua_pushstring + .as_ref() + .expect("Expected function, got error."))(L, s) + } + pub unsafe fn lua_pushvfstring( + &self, + L: *mut lua_State, + fmt: *const ::std::os::raw::c_char, + argp: *mut __va_list_tag, + ) -> *const ::std::os::raw::c_char { + (self + .lua_pushvfstring + .as_ref() + .expect("Expected function, got error."))(L, fmt, argp) + } + pub unsafe fn lua_pushcclosure( + &self, + L: *mut lua_State, + fn_: lua_CFunction, + n: ::std::os::raw::c_int, + ) { + (self + .lua_pushcclosure + .as_ref() + .expect("Expected function, got error."))(L, fn_, n) + } + pub unsafe fn lua_pushboolean(&self, L: *mut lua_State, b: ::std::os::raw::c_int) { + (self + .lua_pushboolean + .as_ref() + .expect("Expected function, got error."))(L, b) + } + pub unsafe fn lua_pushlightuserdata(&self, L: *mut lua_State, p: *mut ::std::os::raw::c_void) { + (self + .lua_pushlightuserdata + .as_ref() + .expect("Expected function, got error."))(L, p) + } + pub unsafe fn lua_pushthread(&self, L: *mut lua_State) -> ::std::os::raw::c_int { + (self + .lua_pushthread + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_gettable(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_gettable + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_getfield( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + k: *const ::std::os::raw::c_char, + ) { + (self + .lua_getfield + .as_ref() + .expect("Expected function, got error."))(L, idx, k) + } + pub unsafe fn lua_rawget(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_rawget + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_rawgeti( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) { + (self + .lua_rawgeti + .as_ref() + .expect("Expected function, got error."))(L, idx, n) + } + pub unsafe fn lua_createtable( + &self, + L: *mut lua_State, + narr: ::std::os::raw::c_int, + nrec: ::std::os::raw::c_int, + ) { + (self + .lua_createtable + .as_ref() + .expect("Expected function, got error."))(L, narr, nrec) + } + pub unsafe fn lua_newuserdata( + &self, + L: *mut lua_State, + sz: usize, + ) -> *mut ::std::os::raw::c_void { + (self + .lua_newuserdata + .as_ref() + .expect("Expected function, got error."))(L, sz) + } + pub unsafe fn lua_getmetatable( + &self, + L: *mut lua_State, + objindex: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_getmetatable + .as_ref() + .expect("Expected function, got error."))(L, objindex) + } + pub unsafe fn lua_getfenv(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_getfenv + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_settable(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_settable + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_setfield( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + k: *const ::std::os::raw::c_char, + ) { + (self + .lua_setfield + .as_ref() + .expect("Expected function, got error."))(L, idx, k) + } + pub unsafe fn lua_rawset(&self, L: *mut lua_State, idx: ::std::os::raw::c_int) { + (self + .lua_rawset + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_rawseti( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) { + (self + .lua_rawseti + .as_ref() + .expect("Expected function, got error."))(L, idx, n) + } + pub unsafe fn lua_setmetatable( + &self, + L: *mut lua_State, + objindex: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_setmetatable + .as_ref() + .expect("Expected function, got error."))(L, objindex) + } + pub unsafe fn lua_setfenv( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_setfenv + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_call( + &self, + L: *mut lua_State, + nargs: ::std::os::raw::c_int, + nresults: ::std::os::raw::c_int, + ) { + (self + .lua_call + .as_ref() + .expect("Expected function, got error."))(L, nargs, nresults) + } + pub unsafe fn lua_pcall( + &self, + L: *mut lua_State, + nargs: ::std::os::raw::c_int, + nresults: ::std::os::raw::c_int, + errfunc: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_pcall + .as_ref() + .expect("Expected function, got error."))(L, nargs, nresults, errfunc) + } + pub unsafe fn lua_cpcall( + &self, + L: *mut lua_State, + func: lua_CFunction, + ud: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int { + (self + .lua_cpcall + .as_ref() + .expect("Expected function, got error."))(L, func, ud) + } + pub unsafe fn lua_load( + &self, + L: *mut lua_State, + reader: lua_Reader, + dt: *mut ::std::os::raw::c_void, + chunkname: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int { + (self + .lua_load + .as_ref() + .expect("Expected function, got error."))(L, reader, dt, chunkname) + } + pub unsafe fn lua_dump( + &self, + L: *mut lua_State, + writer: lua_Writer, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int { + (self + .lua_dump + .as_ref() + .expect("Expected function, got error."))(L, writer, data) + } + pub unsafe fn lua_yield( + &self, + L: *mut lua_State, + nresults: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_yield + .as_ref() + .expect("Expected function, got error."))(L, nresults) + } + pub unsafe fn lua_resume( + &self, + L: *mut lua_State, + narg: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_resume + .as_ref() + .expect("Expected function, got error."))(L, narg) + } + pub unsafe fn lua_status(&self, L: *mut lua_State) -> ::std::os::raw::c_int { + (self + .lua_status + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_gc( + &self, + L: *mut lua_State, + what: ::std::os::raw::c_int, + data: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self.lua_gc.as_ref().expect("Expected function, got error."))(L, what, data) + } + pub unsafe fn lua_error(&self, L: *mut lua_State) -> ::std::os::raw::c_int { + (self + .lua_error + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_next( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_next + .as_ref() + .expect("Expected function, got error."))(L, idx) + } + pub unsafe fn lua_concat(&self, L: *mut lua_State, n: ::std::os::raw::c_int) { + (self + .lua_concat + .as_ref() + .expect("Expected function, got error."))(L, n) + } + pub unsafe fn lua_getallocf( + &self, + L: *mut lua_State, + ud: *mut *mut ::std::os::raw::c_void, + ) -> lua_Alloc { + (self + .lua_getallocf + .as_ref() + .expect("Expected function, got error."))(L, ud) + } + pub unsafe fn lua_setallocf( + &self, + L: *mut lua_State, + f: lua_Alloc, + ud: *mut ::std::os::raw::c_void, + ) { + (self + .lua_setallocf + .as_ref() + .expect("Expected function, got error."))(L, f, ud) + } + pub unsafe fn lua_setlevel(&self, from: *mut lua_State, to: *mut lua_State) { + (self + .lua_setlevel + .as_ref() + .expect("Expected function, got error."))(from, to) + } + pub unsafe fn lua_getstack( + &self, + L: *mut lua_State, + level: ::std::os::raw::c_int, + ar: *mut lua_Debug, + ) -> ::std::os::raw::c_int { + (self + .lua_getstack + .as_ref() + .expect("Expected function, got error."))(L, level, ar) + } + pub unsafe fn lua_getinfo( + &self, + L: *mut lua_State, + what: *const ::std::os::raw::c_char, + ar: *mut lua_Debug, + ) -> ::std::os::raw::c_int { + (self + .lua_getinfo + .as_ref() + .expect("Expected function, got error."))(L, what, ar) + } + pub unsafe fn lua_getlocal( + &self, + L: *mut lua_State, + ar: *const lua_Debug, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char { + (self + .lua_getlocal + .as_ref() + .expect("Expected function, got error."))(L, ar, n) + } + pub unsafe fn lua_setlocal( + &self, + L: *mut lua_State, + ar: *const lua_Debug, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char { + (self + .lua_setlocal + .as_ref() + .expect("Expected function, got error."))(L, ar, n) + } + pub unsafe fn lua_getupvalue( + &self, + L: *mut lua_State, + funcindex: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char { + (self + .lua_getupvalue + .as_ref() + .expect("Expected function, got error."))(L, funcindex, n) + } + pub unsafe fn lua_setupvalue( + &self, + L: *mut lua_State, + funcindex: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *const ::std::os::raw::c_char { + (self + .lua_setupvalue + .as_ref() + .expect("Expected function, got error."))(L, funcindex, n) + } + pub unsafe fn lua_sethook( + &self, + L: *mut lua_State, + func: lua_Hook, + mask: ::std::os::raw::c_int, + count: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int { + (self + .lua_sethook + .as_ref() + .expect("Expected function, got error."))(L, func, mask, count) + } + pub unsafe fn lua_gethook(&self, L: *mut lua_State) -> lua_Hook { + (self + .lua_gethook + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_gethookmask(&self, L: *mut lua_State) -> ::std::os::raw::c_int { + (self + .lua_gethookmask + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_gethookcount(&self, L: *mut lua_State) -> ::std::os::raw::c_int { + (self + .lua_gethookcount + .as_ref() + .expect("Expected function, got error."))(L) + } + pub unsafe fn lua_upvalueid( + &self, + L: *mut lua_State, + idx: ::std::os::raw::c_int, + n: ::std::os::raw::c_int, + ) -> *mut ::std::os::raw::c_void { + (self + .lua_upvalueid + .as_ref() + .expect("Expected function, got error."))(L, idx, n) + } + pub unsafe fn lua_upvaluejoin( + &self, + L: *mut lua_State, + idx1: ::std::os::raw::c_int, + n1: ::std::os::raw::c_int, + idx2: ::std::os::raw::c_int, + n2: ::std::os::raw::c_int, + ) { + (self + .lua_upvaluejoin + .as_ref() + .expect("Expected function, got error."))(L, idx1, n1, idx2, n2) + } + pub unsafe fn lua_loadx( + &self, + L: *mut lua_State, + reader: lua_Reader, + dt: *mut ::std::os::raw::c_void, + chunkname: *const ::std::os::raw::c_char, + mode: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int { + (self + .lua_loadx + .as_ref() + .expect("Expected function, got error."))(L, reader, dt, chunkname, mode) + } +} diff --git a/quant.ew/init.lua b/quant.ew/init.lua index c88c4d50..fd7665cd 100755 --- a/quant.ew/init.lua +++ b/quant.ew/init.lua @@ -1,6 +1,11 @@ dofile_once("mods/quant.ew/NoitaPatcher/load.lua") np = require("noitapatcher") +package.cpath = package.cpath .. ";./mods/quant.ew/?.dll" +package.path = package.path .. ";./mods/quant.ew/?.lua" +print(package.cpath) +require("ewext") + dofile_once( "data/scripts/lib/utilities.lua" ) dofile_once("mods/quant.ew/files/system/player/player_cosmetics.lua")