Age | Commit message (Collapse) | Author |
|
|
|
* Make Lua Send
* Add Send bounds to (nearly) all instances where userdata and functions are
passed to Lua
* Add a "scope" method which takes a callback that accepts a `Scope`, and give
`Scope` the ability to create functions and userdata that are !Send, *and also
functions that are not even 'static!*.
|
|
|
|
|
|
Provide a method for automatic cleanup of expired RegistryKey values, so that
manually cleaning up registry values is optional.
|
|
|
|
|
|
|
|
|
|
|
|
Now, simply remove the userdata table immediately before dropping the userdata.
This does two things, it prevents __gc from double dropping the userdata, and
after the first call to __gc, it prevents the userdata from being identified as
any particular userdata type, so it cannot be misused after being finalized.
This change thus removes the userdata invalidation error, and simplifies a lot
of userdata handling code.
It also fixes a panic bug. Because there is no predictable order for
finalizers, it is possible to run a userdata finalizer that does not resurrect
itself before a lua table finalizer that accesses that userdata, and this means
that there were several asserts that were possible to trigger in normal Lua code
in util.rs related to `WrappedError`.
Now, finalized userdata is simply a userdata with no methods, so any use of
finalized userdata becomes a normal script runtime error (though, with a
potentially confusing error message). As a future improvement, we could set
a metatable on finalized userdata that provides a better error message.
|
|
|
|
|
|
|
|
`lua_setuservalue`
|
|
Also fixes a safety issue with RegistryKey, where you could use RegistryKeys
with mismatching Lua instances.
|
|
Clarify a few docs
|
|
|
|
|
|
|
|
|
|
This is a pretty opinionated change, but I find documentation to be
clearer when using plain old names everybody understands immediately.
|
|
Experimentally use the `failure` crate for errors
|
|
|
|
|
|
|
|
Also, during the implementation of this, I noticed a problem with the 0.10
memory safety, which is that luaL_ref is also memory unsafe. I attempted to
change the API to support luaL_ref potentially returning Result, but this change
will cause an enormous amount of API chaos, (just as an example, it becomes
impossible to implement Clone for LuaRef as is). Instead, luaL_ref now is
guarded by gc_guard.
|
|
|
|
|
|
Also includes some fixes for stack usage and changes an assert_eq to lua_assert
|
|
|
|
|
|
|
|
|
|
Also make sure that panic messages clearly state that they are internal errors,
so people report them as a bug. Since the only panics left are all internal
errors, just move the internal error message into the panic / assert macros.
|
|
- Update readme, changelog, cargo version number in preparation for release
- Remove panicking behavior on recursive callback calls, add additional error
variant for recursive callback errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- auto formatting
- add gc control to ffi
- add gc_guard to util functions
- use gc_guard to make util error handling functions never trigger __gc
metamethod Lua errors even without __gc metatable wrapper
- sort of a technicality, don't call luaL_requiref outside of the Lua
constructor, as it could trigger the garbage collector when user code has had
a chance to set __gc metamethods. Changes the API to load the debug table.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
slowly trying to refactor things until using all the protected calls in
protected_ffi is workable
|