v0.3.0
Huge release! Much safer Executor
API that no longer requires recursion
from Rust -> Lua -> Rust for Rust callbacks to call Lua functions, eliminating
problems with unrestricted Rust stack usage. The Executor
API also has a
bunch more weird powers that other implementations of Lua can't have, like "tail
resuming" other coroutines and "tail yield".
There is a new piccolo-util
crate that adds support for some very common use
cases that are not trivial to do in piccolo
proper:
- Serde support for convenient conversion between Rust types and Lua tables.
- "Freeze" system to safely support the common case where you need to pass
a non-'static (and non-'gc) value into Lua. Not specific to piccolo, it is
actually a general way of safely erasing a single lifetime parameter from a
type (and replacing it with a runtime check). - Super quick and simple way to wrap Rust types into a Lua userdata with
methods.
piccolo-util
will always be an optional dependency, and it may contain
code that is more opinionated or limited than vanilla piccolo
should be.
piccolo-util
will have opionions about things, and those opinions may be
different than yours... if it is in your way or incomplete for your use, you can
always use it as a starting point for something better.
Also includes a lot of quality of life API improvements, error message
improvements, and more!
- New
Executor
API that enables safe thread recursion and "tail resume" /
"tail yield". - New
piccolo-util
crate with very commonly requested, useful features that
are too opinionated or limited to belong inpiccolo
proper. - API changes to
Stack
to support a single, unified thread stack shared
between Lua and callbacks, similar to PUC-Rio Lua et al. - Upvalues no longer keep entire threads alive and instead use new gc-arena
finalization support to become closed when threads are garbage collected. IntoMultiValue
/FromMultiValue
conversion for tuples now allows every
element to be multi-converted rather than just the last element.- Support the
__eq
metamethod. - Error message improvements in lexer / parser errors (they now have line
numbers at least!). - API changes to second callback parameter, now an
Execution
type withFuel
access and also calling thread information. - Add "chunk name" information to compiled chunks for future use in runtime
errors / tracebacks. - Simplified
ctx
access, most methods are now directly implemented onContext
. - Lots of type renames for clarity,
AnyCallback
->Callback
,AnyUserData
->UserData
,AnyValue
->Any
, and others. - Add line number annotations to opcodes for future tracebacks.
- Clean up general ptr handling and allow the user to access internal
Gc
pointers in all cases, allows for weak pointers to all pointer types.