- Add "deprecated" badge
- Switch to being a wrapper around mlua
- Update rustyline dev-dependency (thanks @salexan2001)
- Fix builds for iOS (thanks @w-ensink)
- Add an example changing
package.path(thanks @paulfrische) - Fix crash on empty source with LuaJIT
- Update some dependencies
- Fix a leak when destroying
Luaobject withLuaJIT.
- Cosmetic fixes to README.md
- Initial support for LuaJIT (thanks lazytiger)
- Update to Lua 5.4.6 (thanks @0x2ec)
- Fix the
lua-no-oslibfeature introduced with a bug in 0.19.3.
- Add new features
lua-no-oslibto not compile in theoslib to the Lua library. Useful for targets (e.g. iOS) where theoslib is unavailable.
- Fix issue #253 (userdata types with alignment > 8 bytes could cause crashes)
- The -sys crates (bumped to 0.1.1) now use pregenerated bindgen outputs in the package instead of running bindgen at build time. This means that libclang is no longer needed when building.
- A Windows build has been added to CI.
- The Lua C library build now uses separate -sys crates, and bindgen rather than hand-maintained declarations. (Thanks @pollend!) The "builtin-lua51" feature is now available.
- Value::Integer is now no longer available when building for Lua 5.1. (In Lua 5.1 there is no integer type).
- Add
Function::dump()which produces the compiled version of a function (like thestring.dumpLua function orlua_dump()C API). - Add unsafe
Chunk::into_function_allow_binary(). This allows loading a compiled binary generated fromFunction::dump(). - Add
Initflagsto control some settings done whenLuais initialised. They can be specified with the new unsafeLua::unsafe_new_with_flags()constructor. The flags available (all set by default with the other constructors):- PCALL_WRAPPERS:
- wrap pcall and xpcall so that they don't allow catching Rust panics
- LOAD_WRAPPERS:
- wrap functions load, loadfile, dofile (and loadstring for lua 5.1) to prevent loading compiled/bytecode modules.
- REMOVE_LOADLIB:
- Remove
package.loadliband the module finding functions which allow loading compiled C libraries.
- Remove
- PCALL_WRAPPERS:
String<'lua>now implementsEqandHash(can be useful for local collections within a context callback).
- Add support for multiple Lua versions, including 5.1, 5.3 and 5.4 (the default)
- Add implementations of
FromLuaandToLuafor[T;N].
- Add "lua-compat-mathlib" feature, which enables Lua's LUA_COMPAT_MATHLIB option.
- Bump num-traits version to 0.2.14 and fix some incompatibilities
- Fix some tests from improved diagnostics in recent rustc.
- API incompatible change: depend on
bstrcrate and implementToLua/FromLuaforBStringandBStrtypes (thanks @azdle!) - Add methods (
Lua::[unsafe]_load_from_stdlibload from the Lua stdlib on an existing instance (thanks @azdle!) - Actually print the cause error in
Error::CallbackError(thanks @LPGhatguy!) - API incompatible change: Add
MetaMethod::Pairsfor the metamethod used by the bult-inpairsfunction (thanks @steven-aerts!)
- Add a
Context::current_threadmethod to get a reference to theThreadbacking a givenContext. - Portability fix: Remove a needless cast, fixing builds targetting armv7.
- Small documentation improvements, additional tests
- Documentation fixes
- Performance improvement to scoped and non-scoped UserDataMethods. Still could be much better, further improvements coming eventually.
- API incompatible change (soundness fix): Remove unintentional ability to load bytecode via
Context::load. Now only loads text source, bytecode can cause UB in the Lua VM.
- Documentation fixes
- Small fixes for the way new
Luastates are created, preventing some potential unhandled errors - Propery mark all internal panics as internal and indicative of a bug
- HUGE API incompatible change: move most of the
LuaAPI intoContextand require context callbacks to generate a branding lifetime, and use this branding lifetime on handle types. Fixes a hard to trigger soundness issue, and removes the only remaining API panic (that is not a bug). See the documentation for theLuatype for more details. - Fix
error_tracebackto work in all cases (thanks @yasumutte!) - Use compiletest_rs on stable
- API incompatible change: Change to use 2018 edition,
rluanow requires rustc 1.31 to use. - Implement
ToLuaforCStrandCString, implementFromLuaforCString(thanks @althonos!) - Add ability to control what std libraries are loaded in a Lua state on startup (huge thanks to @Shiroy!)
- Add ability to set the Lua "hook function", which allows for limiting the execution of running scripts (huge thanks to @lemarcuspoilus!)
- API incompatible change: remove
failureas a dependency,Errorno longer implementsfailure::Fail. - API incompatible change: change the API for loading Lua chunks to allow for changing _ENV.
Context::loadnow returns a builder on which you can set the chunk name and _ENV. - API incompatible change: remove
strassumptions from the remaining places: theUserDatatrait and named registry keys - (Painstakingly!) remove the need for the
gc_guardgarbage collector hack, and thus also the "abort on OOM" hack. - Add an API for memory limits, now possible because of removal of
gc_guard. - Add an API for controlling the garbage collector, also now possible due to the removal of
gc_guard. - Remove the last internal aborts from
rlua, possible to make safe due to the removal ofgc_guard.
- Fix improper num-traits dependency, proper [ui]128 support only added later in 0.2 series (thanks @sakridge for catching this!)
- API Incompatible change: Allow
Lua::loadLua::execandLua::evalto take &String &str and &[u8] likeLua::create_stringdoes. I think this might be technically allowed in a minor revision, but due to how rlua is used it's definitely more like an API incompatible change. This is a last minute same-day change to 0.15 though, so there's no sense in adding another version bump.
- Docs and changelog fixes
- Implement MultiValue conversion up to 16
- Small fix to prevent leaking on errors in metatable creation
- API incompatible change: New API for non-'static UserData! Scoped UserData is
now split into
create_static_userdataandcreate_nonstatic_userdatabecause there are certain limitations oncreate_nonstatic_userdatathat mean that nonstatic is not always what you want. - API incompatible change: In order to support the new non-'static scoped UserData, the API for UserData methods has changed, and UserDataMethods is now a trait rather than a concrete type.
- Added pkg-config feature that can be used if builtin-lua is disabled to use pkg-config to find lua5.3 externally (thanks @acrisci!).
- API incompatible change: Add conversions for i128 and u128 and change the
behavior of numeric conversions to not implicitly
ascast. Numeric conversions now usenum_traits::castinternally and error when the cast function fails. This errors on out of range but not loss of precision, so casting 1.1f64 to i32 will succeed, but casting (1i64 << 32) to i32 will not. When casting to lua, integers that are out of range of the lua_Integer type are instead converted to lua_Number. - Allow arbitrary &[u8]-like data in
Lua::create_string. This usesAsRef<[u8]>so you can use &str and &String, but you can also now use&[u8], which enables you to create non-utf8 Lua strings.
- Another soundness fix for
Lua::scopethat is related to the last soundness fix, forbidding capturing 'lua arguments inside callbacks. This, like the previous fix, is a breaking change, but anything that it breaks was probably unsound.
- Update to require failure 0.1.2 and fix deprecation warnings.
- Update embedded Lua to 5.3.5
- Important soundness fix for
Lua::scope, no longer allow callbacks created fromScopeto leak their parameters.
- Lots of performance improvements, including one major change: Lua handles no longer use the registry, they now instead are stored in an auxiliary thread stack created solely for the purpose of holding ref values. This may seem extremely weird, but it is vastly faster than using the registry or raw tables for this purpose. The first attempt here was to use the same stack and to do a lot of complex bookkeeping to manage the references, and this DOES work, but it comes with a lot of complexity and downsides along with it. The second approach of using an auxiliary thread turned out to be equally fast and with no real downsides over the previous approach. With all the performance improvements together, you can expect (VERY rough estimate) somewhere on the order of 30%-60% CPU time reduction in the cost of bindings, depending on usage patterns.
- Addition of some simple criterion.rs based benchmarking. This is the first
rluarelease to focus on performance, but performance will hopefully remain a focus going forward. - API incompatible change:
Luais no longerRefUnwindSafeand associated handle values are no longerUnwindSafeorRefUnwindSafe. They should not have been marked as such before, because they are extremely internally mutable, so this can be considered a bugfix. Allrluatypes should actually be perfectly panic safe as far as internal invariants are concerned, but (afaict) they should not be marked asRefUnwindSafedue to internal mutability and thus potentially breaking user invariants. - Upgrade to require
cc1.0. - Several Lua stack checking bugs have been fixed that could have lead to unsafety in release mode.
- Small API incompatible change which fixes unsafety: Scope and scope created handle lifetimes have been changed to disallow them from escaping the scope callback. Otherwise, this could lead to dangling registry handles, which can be used to cause UB. This is the only API change for 0.13.
- Small fixes for potential panics / longjmps around the embedded traceback function.
- Temporary fix for #71 that works on stable rust without dirty tricks, while waiting for the larger fix for rust #48251 to make its way to stable.
- Some minor documentation fixes.
- Fix for some rare panics which might result in an abort from panicking across a C API boundary.
- Fix a stupid bug where
AnyUserData::set_user_value/AnyUserData::get_user_valuecould panic if theToLua/FromLuatype conversion failed. - Add
UserDataMethods::add_function_mutandUserDataMethods::add_meta_function_mutfor symmetry. - Add some more documentation for changes in 0.12, and fix some minor problems.
- Changed how userdata values are garbage collected, both to fix potential
panics and to simplify it. Now, when userdata is garbage collected, it will
be given a special "destructed userdata" metatable, and all interactions with
it will error with
CallbackDestructed. From the rust side, an expired userdataAnyUserDatawill not appear to be any rust type. - Changed the
RegistryKeyAPI to be more useful and general. Now, it is not 100% necessary to manually removeRegistryKeys in order to clean up the registry, instead you can periodically callLua::expire_registry_valuesto remove registry values withRegistryKeys that have all been dropped. Also, it is no longer a panic to use aRegistryKeyfrom a mismatched Lua instance, it is simply an error. - Lua is now
Send, and all userdata / callback functions have a Send requirement. This is a potentially annoying breaking change, but there is a new way to pass !Send types to Lua in a limited way. - HUGE change, there is now a
Lua::scopemethod, which allows passing non-'static functions to Lua in a controlled way. It also allows passing !Send functions and !Send userdata to Lua, with the same limitations. In order to make this safe, the scope method behaves similarly to thecrossbeamcrate'scrossbeam::scopemethod, which ensures that types created within the scope are destructed at the end of the scope. When using callbacks / userdata created within the scope, the callbacks / userdata are guaranteed to be destructed at the end of the scope, and inside Lua references to them are in an invalidated "destructed" state. This destructed state was already possible to observe through__gcmethods, so it doesn't introduce anything new, but it has been fixed so that it cannot cause panics, and has a specific error type. - Correctly error on passing too many arguments to an
rlua::Function, and correctly error when returning too many results from a callback. Previously, this was a panic. Lua::create_functionis now split intoLua::create_functionandLua::create_function_mut, where the first takes a Fn and the second takes a FnMut. This allows for recursion into rust functions if the function is not FnMut. There is a similar change forUserDataMethods, where the mut variants of the functions now takeFnMut, and the non-mut variants takeFn. There is not a way to make a non-mutUserDataMethodsmethod with a FnMut function.
rlua::Errornow implementsfailure::Failand notstd::error::Error, and external errors now requirefailure::Fail. This is the only API incompatible change for 0.11, and my hope is that it is relatively minor. There are no additional bounds on external errors, since there is a blanket impl forT: std::error::Error + Send + Syncoffailure::Fail, butrlua::Errorno longer implementsstd::error::Errorand there is an additional dependency, and that is more likely to cause breakage.- protect a call to
luaL_refwhen creating new userdata types. - Some documentation improvements for
Error,Lua::create_function, andMetaMethod, and a rustdoc warning fix (thanks @jonas-schievink!) - Expose the
RegistryKeytype in the API properly, which makes the API around it vastly easier to use! Also fixes a safety hole around using theRegistryKeyAPI with the wrongLuainstance. - Add an API for "user values", which are arbitrary Lua values that can be attached to userdata.
- Registry API for storing values inside the
Luainstance, either by string or by automatically generated keys. - Important memory safety fix for
luaL_ref.
- Documentation spelling fix
- Handle all 'm' functions in the Lua C API correctly, remove LUA_ERRGCMM hacks.
- Lots and lots of internal changes to support handling all 'm' errors
- Change the API in a lot of places due to functions that can trigger the gc now potentially causing Error::GarbageCollectorError errors.
- Add unsafe function to load the debug Lua module (thanks @Timidger!)
- Fix setmetatable wrapper with nil metatable (thanks again to @Timidger!)
- Fix an annoying bug that made external errors appear to have no further cause errors in the cause chain.
- Fix incorrect
xpcallbehavior - Change FromLua / ToLua impls for HashMap to be generic over the hasher. This may be technically a backwards incompatible change, but this would be really unusual though, and I don't think it deserves an API bump.
- Fix quadratic behavior in
Function::bind lua_checkstackfixes, particularly fixing a crash bug due to luaL_ref using a single extra stack space.
- Soundness fix for recursive function calls, now causes a panic. This is temporary while I work on a more major update that prevents panics / aborts from scripts.
- Bugfix, don't load the "base" library into the "base" global variable @jonas-schievink
- Additional documentation work, a link fix for
Variadicdocs, new crate documentation @jonas-schievink - Metatable access on
Table gcccrate warning fix for 0.3.52 and up- Bugfix for
Table::raw_get, now actually calls raw_get and is sound.
- Add travis badge
- Huge API change, removed the
Luaprefix on all types, changes to callback signature that remove the need for manual wrapping and unwrapping in most cases. - Tons of soundness bugfixes, very few soundness problems remain.
- Tons of documentation and bugifx work @jonas-schievink
- Major API change, out of stack space is no longer an Err, you should not be able to run out of stack space by using this API, except through bugs.
- Simplification of error types
- API change to remove dependency on
error_chain, major changes to error handling strategy to allow Lua to catch and rethrow rust errors sanely.