- Minimal Luau updated to 0.650
- Added Luau native vector library support (this can change behavior if you use
vector
function!) - Added Lua
String::display
method - Improved pretty-printing for Lua tables (#478)
- Added
Scope::create_any_userdata
to create Lua objects from any non-'static
Rust types - Added
AnyUserData::destroy
method - New
userdata-wrappers
feature toimpl UserData
forRc<T>
/Arc<T>
/Rc<RefCell<T>>
/Arc<Mutex<T>>
(similar to v0.9) UserDataRef
insend
mode now uses shared lock ifT: Sync
(and exclusive lock otherwise)- Added
Scope::add_destructor
to attach custom destructors - Added
Lua::try_app_data_ref
andLua::try_app_data_mut
methods - Added
From<Vec>
andInto<Vec>
support toMultiValue
andVariadic
types - Bug fixes and improvements (#477 #479)
Changes since v0.10.0-rc.1
- Added
error-send
feature flag (disabled by default) to requireSend + Sync
forError
- Some performance improvements
Lua::scope
is back- Support yielding from hooks for Lua 5.3+
- Support setting metatable for Lua builtin types (number/string/function/etc)
- Added
LuaNativeFn
/LuaNativeFnMut
/LuaNativeAsyncFn
traits for using inFunction::wrap
- Added
Error::chain
method to return iterator over nested errors - Added
Lua::exec_raw
helper to execute low-level Lua C API code - Added
Either<L, R>
enum to combine two types into a single one - Added a new
Buffer
type for Luau - Added
Value::is_error
andValue::as_error
helpers - Added
Value::Other
variant to represent unknown Lua types (eg LuaJIT CDATA) - Added (optional)
anyhow
feature to implementIntoLua
foranyhow::Error
- Added
IntoLua
/FromLua
forOsString
/OsStr
andPathBuf
/Path
- Updated
ThreadStatus
enum to includeRunning
andFinished
variants. Error::CoroutineInactive
renamed toError::CoroutineUnresumable
.IntoLua
/IntoLuaMulti
now usesimpl trait
syntax for args (shorten froma.get::<_, T>
toa.get::<T>
).- Removed undocumented
Lua::into_static
/from_static
methods. - Futures now require
Send
bound ifsend
feature is enabled. - Dropped lifetime from
UserDataMethods
andUserDataFields
traits. Compiler::compile()
now returnsResult
(Luau).- Removed
Clone
requirement fromUserDataFields::add_field()
. TableExt
andAnyUserDataExt
traits were combined intoObjectLike
trait.- Disabled
send
feature in module mode (since we don't have exclusive access to Lua). Chunk::set_environment()
takesTable
instead ofIntoLua
type.- Reduced the compile time contribution of
next_key_seed
andnext_value_seed
. - Reduced the compile time contribution of
serde_userdata
. - Performance improvements.
- Dropped
'lua
lifetime (subtypes now store a weak reference to Lua) - Removed (experimental) owned types (they no longer needed)
- Make Lua types truly
Send
andSync
(when enablingsend
feature flag) - Removed
UserData
impl for Rc/Arc types ("any" userdata functions can be used instead) Lua::replace_registry_value
takes&mut RegistryKey
Lua::scope
temporary disabled (will be re-added in the next release)
- Minimal Luau updated to 0.629
- Fixed bug when attempting to reset or resume already running coroutines (#416).
- Added
RegistryKey::id()
method to get the underlying Lua registry key id.
- Fixed serializing same table multiple times (#408)
- Use
mlua-sys
v0.6 (to support Luau 0.624+) - Fixed cross compilation of windows dlls from unix (#394)
- Implemented
IntoLua
forRegistryKey
- Mark
__idiv
metamethod as available for luau - Added
Function::deep_clone()
method (Luau) - Added
SerializeOptions::detect_serde_json_arbitrary_precision
option - Added
Lua::create_buffer()
method (Luau) - Support serializing buffer type as a byte slice (Luau)
- Perf: Implemented
push_into_stack
/from_stack
forOption<T>
- Added
Lua::create_ser_any_userdata()
method
- Added
to_pointer
function toFunction
/Table
/Thread
- Implemented
IntoLua
for&Value
- Implemented
FromLua
forRegistryKey
- Faster (~5%) table array traversal during serialization
- Some performance improvements for bool/int types
- Minimal Luau updated to 0.609
- Luau max stack size increased to 1M (from 100K)
- Implemented
IntoLua
for refs toString
/Table
/Function
/AnyUserData
/Thread
+RegistryKey
- Implemented
IntoLua
andFromLua
forOwnedThread
/OwnedString
- Fixed
FromLua
derive proc macro to cover more cases
- Fixed loading all-in-one modules under mixed states (eg. main state and coroutines)
- WebAssembly support (
wasm32-unknown-emscripten
target) - Performance improvements (faster Lua function calls for lua51/jit/luau)
- Added binary modules support to Luau
- Added Luau package module (uses
StdLib::PACKAGE
) with loaders (follows lua5.1 interface) - Added support of Luau 0.601+ buffer type (represented as userdata in Rust)
- LuaJIT
cdata
type is also represented as userdata in Rust (instead of panic) - Vendored LuaJIT switched to rolling vanilla (from openresty)
- Added
Table::for_each
method for fast table pairs traversal (faster thanpairs
) - Performance improvements around table traversal (and faster serialization)
- Bug fixes and improvements
- impl Default for Lua
- impl IntoLuaMulti for
std::result::Result<(), E>
- Fix using wrong userdata index after processing Variadic args (#311)
Changes since v0.9.0-rc.3
- Improved non-static (scoped) userdata support
- Added
Scope::create_any_userdata()
method - Added
Lua::set_vector_metatable()
method (unstable
feature flag) - Added
OwnedThread
type (unstable
feature flag) - Minimal Luau updated to 0.590
- Added new option
sort_keys
toDeserializeOptions
(Lua::from_value()
method) - Changed
Table::raw_len()
output type tousize
- Helper functions for
Value
(eg:Value::as_number()
/Value::as_string
/etc) - Performance improvements
- Minimal Luau updated to 0.588
- Added
#[derive(FromLua)]
macro to opt-in intoFromLua<T> where T: 'static + Clone
(userdata type). - Support vendored module mode for windows (raw-dylib linking, Rust 1.71+)
module
andvendored
features are now mutually exclusive- Use
C-unwind
ABI (Rust 1.71+) - Changed
AsChunk
trait to support capturing wrapped Lua types
UserDataMethods::add_async_method()
takes&T
instead of cloningT
- Implemented
PartialEq<[T]>
for tables - Added Luau 4-dimensional vectors support (
luau-vector4
feature) Table::sequence_values()
iterator no longer uses any metamethods (Table::raw_sequence_values()
is deprecated)- Added
Table:is_empty()
function that checks both hash and array parts - Refactored Debug interface
- Re-exported
ffi
(mlua-sys
) crate for easier writing of unsafe code - Refactored Lua 5.4 warnings interface
- Take
&str
as function name inTableExt
andAnyUserDataExt
traits - Added module attribule
skip_memory_check
to improve performance - Added
AnyUserData::wrap()
to provide more easy way of creating any userdata in Lua
- Added
OwnedAnyUserData::take()
- Switch to
DeserializeOwned
- Overwrite error context when called multiple times
- New feature flag
luau-jit
to enable (experimental) Luau codegen backend - Set
__name
field in userdata metatable - Added
Value::to_string()
method similar toluaL_tolstring
- Lua 5.4.6
- Application data container now allows to mutably and immutably borrow different types at the same time
- Performance optimizations
- Support getting and setting environment for Lua functions.
- Added
UserDataFields::add_field()
method to add static fields to UserData
Breaking changes:
- Require environment to be a
Table
instead ofValue
in Chunks. AsChunk::env()
renamed toAsChunk::environment()
New features:
- Added
Thread::set_hook()
function to set hook on threads - Added pretty print to the Debug formatting to Lua
Value
andTable
- ffi layer moved to
mlua-sys
crate - Added OwnedString (unstable)
Breaking changes:
- Refactor
HookTriggers
(make it const)
New features:
- Owned Lua types (unstable feature flag)
- New functions
Function::wrap
/Function::wrap_mut
/Function::wrap_async
Lua::register_userdata_type()
to register a custom userdata types (without requiringUserData
trait)Lua::create_any_userdata()
- Added
create_userdata_ref
/create_userdata_ref_mut
for scopes - Added
AnyUserDataExt
trait with auxiliary functions forAnyUserData
- Added
UserDataRef
andUserDataRefMut
type wrapped that implementFromLua
- Improved error handling:
- Improved error reporting when calling Rust functions from Lua.
- Added
Error::BadArgument
to help identify bad argument position or name - Added
ErrorContext
extension trait to attach additional context toError
Breaking changes:
- Refactored
AsChunk
trait ToLua
/ToLuaMulti
renamed toIntoLua
/IntoLuaMulti
- Renamed
to_lua_err
tointo_lua_err
- Removed
FromLua
impl forT: UserData+Clone
- Removed
Lua::async_scope
- Added
&Lua
arg to Luau interrupt callback
Other:
- Better Debug for String
- Allow deserializing values from serializable UserData using
Lua::from_value()
method - Added
Table::clear()
method - Added
Error::downcast_ref()
method - Support setting memory limit for Lua 5.1/JIT/Luau
- Support setting module name in
#[lua_module(name = "...")]
macro - Minor fixes and improvements
- Update to Luau 0.590 (luau0-src to 0.7.x)
- Fix loading luau code starting with \t
- Pin lua-src and luajit-src versions
- Update minimal (vendored) Lua 5.4 to 5.4.6
- Use
lua_closethread
instead oflua_resetthread
in vendored mode (Lua 5.4.6) - Allow deserializing Lua null into unit (
()
) or unit struct.
- Fix potential deadlock when trying to reuse dropped registry keys.
- Optimize userdata methods call when __index and fields_getters are nil
- Minimum Luau updated to 0.555 (
LUAI_MAXCSTACK
limit increased to 100000) _VERSION
in Luau now includes version number- Fixed lifetime of
DebugNames
inDebug::names()
andDebugSource
inDebug::source()
- Fixed subtraction overflow when calculating index for
MultiValue::get()
- Fixed bug when recycled Registry slot can be set to Nil
- Fixed potential unsoundness when using
Layout::from_size_align_unchecked
and Rust 1.65+ - Performance optimizations around string and table creation in standalone mode
- Added fast track path to Table
get
/set
/len
methods without metatable - Added new methods
push
/pop
/raw_push
/raw_pop
to Table - Fix getting caller information from
Lua::load
- Better checks and tests when trying to modify a Luau readonly table
- Minimal Luau updated to 0.548
- Close to-be-closed variables for Lua 5.4 when using call_async functions (#192)
- Fixed Lua assertion when inspecting another thread stack. (#195)
- Use more reliable way to create LuaJIT VM (which can fail if use Rust allocator on non-x86 platforms)
- Performance optimizations in handling UserData
- Minimal Luau updated to 0.536
- Fixed bug in
Function::bind
when passing empty binds and no arguments (#189)
- Added
Lua::create_proxy
for accessing to UserData static fields and functions without instance - Added
Table::to_pointer()
andString::to_pointer()
functions - Bugfixes and improvements (#176 #179)
Changes since 0.7.4
- Roblox Luau support
- Removed C glue
- Added async support to
__index
and__newindex
metamethods - Added
Function::info()
to get information about functions (#149). - Added
parking_lot
dependency under feature flag (forUserData
) Hash
implementation for Lua String- Added
Value::to_pointer()
function - Performance improvements
Breaking changes:
- Refactored
AsChunk
trait (added implementation forPath
andPathBuf
).
- Lua sources no longer needed to build modules
- Added
__iter
metamethod for Luau - Added
Value::to_pointer()
function - Added
Function::coverage
for Luau to obtain coverage report - Bugfixes and improvements (#153 #161 #168)
- Removed
&Lua
fromLua::set_interrupt
as it's not safe (introduced in v0.8.0-beta.3) - Enabled
Lua::gc_inc
for Luau - Luau
debug
module marked as safe (enabled by default) - Implemented
Hash
for Lua String - Support mode options in
collectgarbage
for Luau - Added ability to set global Luau compiler (used for loading all chunks).
- Refactored
AsChunk
trait (breaking changes).AsChunk
now implemented forPath
andPathBuf
to load lua files from fs. - Added
parking_lot
dependency and feature flag (forUserData
) - Added
Function::info()
to get information about functions (#149). - Bugfixes and improvements (#104 #142)
- Luau vector constructor
- Luau sandboxing support
- Luau interrupts (yieldable)
- More Luau compiler options (mutable globals)
- Other performance improvements
- Luau vector datatype support
- Luau readonly table attribute
- Other Luau improvements
- Roblox Luau support
- Refactored ffi module. C glue is no longer required
- Added async support to
__index
and__newindex
metamethods
- Improved
Lua::create_registry_value
to reuse previously expired registry keys. No need to callLua::expire_registry_values
when creating/dropping registry values. - Added
Lua::replace_registry_value
to change value of an existing Registry Key - Async calls optimization
- Fixed cross-compilation issue (introduced in 84a174c)
- Allow
pkg-config
to omit include paths if they equals to standard (#114). - Various bugfixes (eg. #121)
- Fixed traceback generation for errors (#112)
Lua::into_static/from_static
methods have been removed from the docs and are discouraged for use
- New "application data" api to store arbitrary objects inside Lua
- New feature flag
luajit52
to build/support LuaJIT with partial compatibility with Lua 5.2 - Added async meta methods for all Lua (except 5.1)
- Added
AnyUserData::take()
to take UserData objects from Lua - Added
set_nth_user_value
/get_nth_user_value
toAnyUserData
for all Lua versions - Added
set_named_user_value
/get_named_user_value
toAnyUserData
for all Lua versions - Added
Lua::inspect_stack()
to get information about the interpreter runtime stack - Added
set_warning_function
/remove_warning_function
/warning
functions toLua
for 5.4 - Added
TableExt::call()
to call tables with__call
metamethod as functions - Added
Lua::unload()
to unload modules ToLua
implementation for arrays changed to const generics- Added thread (coroutine) cache for async execution (disabled by default and works for Lua 5.4/JIT)
- LuaOptions and (De)SerializeOptions marked as const
- Fixed recursive tables serialization when using
serde::Serialize
for Lua Tables - Improved errors reporting. Now source included to
fmt::Display
implementation forError::CallbackError
- Major performance improvements
- Fixed calculating
LUA_REGISTRYINDEX
when cross-compiling for lua51/jit (#82) - Updated documentation & examples
- Fixed bug when polling async futures (#77)
- Refactor Waker handling in async code (+10% performance gain when calling async functions)
- Added
Location::caller()
information toLua::load()
if chunk's name is None (Rust 1.46+) - Added serialization of i128/u128 types (serde)
- Performance optimizations
- Fixed table traversal used in recursion detection in deserializer
- Disabled catching Rust panics in userdata finalizers on drop. It also has positive performance impact.
- Added
Debug::event()
to the hook's Debug structure - Simplified interface of
hook::HookTriggers
- Added finalizer to
ExtraData
in module mode. This helps avoiding memory leak on closing state when Lua unloads modules and frees memory. - Added
DeserializeOptions
struct to control deserializer behavior (from_value_with
function).
- New functionality:
Lua::load_from_function()
andLua::create_c_function()
- Many optimizations in callbacks/userdata creation and methods execution
- Update
chunk!
documentation (stable Rust limitations) - Fixed Lua sequence table conversion to HashSet/BTreeSet
once_cell
dependency lowered to 1.0
Changes since 0.5.4
- New
UserDataFields
API - Full access to
UserData
metatables with support of setting arbitrary fields. - Implement
UserData
forRc<RefCell<T>>
/Arc<Mutex<T>>
/Arc<RwLock<T>>
whereT: UserData
. - Added
SerializeOptions
to to change default Lua serializer behaviour (eg.nil/null/array
serialization) - Added
LuaOptions
to customize Lua/Rust behaviour (currently panic handling) - Added
ToLua
/FromLua
implementation forBox<str>
andBox<[T]>
. - Added
Thread::reset()
for luajit/lua54 to recycle threads (coroutines) with attaching a new function. - Added
chunk!
macro support to load chunks of Lua code using the Rust tokenizer and optionally capturing Rust variables. - Improved errors reporting (
Error
's__tostring
method formats full stacktraces). This is useful in a module mode. - Added
String::to_string_lossy
- Various bugfixes and improvements
Breaking changes:
- Errors are always
Send + Sync
to be compatible with the anyhow crate. - Removed
Result
fromLuaSerdeExt::null()
andLuaSerdeExt::array_metatable()
(never fails) - Removed
Result
fromFunction::dump()
(never fails) - Removed
AnyUserData::has_metamethod()
(in favour of full access to metatables)
- Errors are always
Send + Sync
to be compatible with anyhow crate - Implement
UserData
forRc<RefCell>
/Arc<Mutex>
/Arc<RwLock>
- Added
__ipairs
metamethod for Lua 5.2 - Added
String::to_string_lossy
- Various bugfixes and improvements
- [Breaking] Removed
AnyUserData::has_metamethod()
- Added
Thread::reset()
for luajit/lua54 to recycle threads. It's possible to attach a new function to a thread (coroutine). - Added
chunk!
macro support to load chunks of Lua code using the Rust tokenizer and optinally capturing Rust variables. - Improved error reporting (
Error
's__tostring
method formats full stacktraces). This is useful in the module mode.
- New
UserDataFields
API - Allow to define arbitrary MetaMethods
MetaMethods::name()
is public- Do not trigger longjmp in Rust to prevent unwinding across FFI boundaries. See rust-lang/rust#83541
- Added
SerializeOptions
to to change default Lua serializer behaviour (eg. nil/null/array serialization) - [Breaking] Removed
Result
fromLuaSerdeExt::null()
andLuaSerdeExt::array_metatable()
(never fails) - [Breaking] Removed
Result
fromFunction::dump()
(never fails) ToLua
/FromLua
implementation forBox<str>
andBox<[T]>
- [Breaking] Added
LuaOptions
to customize Lua/Rust behaviour (currently panic handling) - Various bugfixes and performance improvements
- Build script improvements
- Improvements in panic handling (resume panic on value popping)
- Fixed bug serializing 3rd party userdata (causes segfault)
- Make error::Error non exhaustive
- Fixed bug when returning nil-prefixed multi values from async function (+ test)
- Performance optimisation for async callbacks (polling)
- Some performance optimisations (callbacks)
ToLua
implementation forCow<str>
andCow<CStr>
- Fixed bug with
Scope
destruction of partially polled futures
- Support cross compilation that should work well for vendored builds (including LuaJIT with some restrictions)
- Fix numeric types conversion for 32bit Lua
- Update tokio to 1.0 for async examples
- Serde support under
serialize
feature flag. - Re-export
mlua_derive
. - impl
ToLua
andFromLua
forHashSet
andBTreeSet
- Added
Function::dump()
to dump lua function to a binary chunk - Added
ChunkMode
enum to mark chunks as text or binary - Updated
set_memory_limit
doc
- Lua 5.4 support with
MetaMethod::Close
. lua53
feature is disabled by default. Now preferred Lua version have to be chosen explicitly.- Provide safety guaraness for Lua state, which means that potenially unsafe operations, like loading C modules (using
require
orpackage.loadlib
) are disabled. Equalient for the previousLua::new()
function isLua::unsafe_new()
. - New
send
feature to requireSend
. - New
module
feature, that disables linking to Lua Core Libraries. Required for modules. - Don't allow
'callback
outlive'lua
inLua::create_function()
to fix the unsoundness. - Added
Lua::into_static()
to make'static
Lua state. This is useful to spawn async Lua threads that requires'static
. - New function
Lua::set_memory_limit()
(similar torlua
) to enable memory restrictions in Lua VM (requires Lua >= 5.2). Scope
, temporary removed in v0.3, is back with async support.- Removed deprecated
Table::call()
function. - Added hooks support (backported from rlua 0.17).
- New
AnyUserData::has_metamethod()
function. - LuaJIT 2.0.5 (the latest stable) support.
- Various bug fixes and improvements.