kyren
2553623b65
Provide custom allocators that ensure that OOM results in an abort
...
(closes unsafety hole)
2017-08-02 16:33:48 -04:00
kyren
16f57d18e5
Merge pull request #34 from jonas-schievink/better-error
...
[WIP] Enhanced errors
2017-08-02 16:00:08 -04:00
kyren
c3c7d8c093
setmetatable should return the table
2017-08-02 15:56:16 -04:00
Jonas Schievink
dd1d335cee
Handle LUA_ERRERR
2017-08-02 21:41:35 +02:00
kyren
9c34d4b99f
Fix soundness problems with rlua
...
setmetatable now wraps a __gc method in a cclosure that aborts on error, also
'debug' library is no longer provided. We could provide just the subset of the
debug library that is sound, though.
2017-08-02 14:36:54 -04:00
kyren
820c38e806
Rename Active / Dead to better reflect their behavior
2017-08-02 13:05:26 -04:00
kyren
b458f91aac
Merge pull request #35 from jonas-schievink/repl
...
Use rustyline for the REPL
2017-08-02 11:21:08 -04:00
kyren
f9f3d05804
Fix argument bugs with pcall / xpcall, add tests for it
2017-08-02 10:42:18 -04:00
Jonas Schievink
95698735a2
Fix multiline inputs
2017-08-02 14:36:10 +02:00
Jonas Schievink
3f20319a84
Use rustyline for the REPL
...
This makes the REPL more usable as you can now edit lines and recall
previously executed statements.
2017-08-02 14:32:45 +02:00
Jonas Schievink
70f05ac068
Remove ErrorError
2017-08-02 14:01:00 +02:00
Jonas Schievink
a43bfd8f63
Remove expected field from FromLuaConversionError
2017-08-02 13:56:28 +02:00
kyren
f6cefca916
Remove stray 'for<'a>' of unused 'a lifetime
2017-08-01 18:35:09 -04:00
Jonas Schievink
a1626399c4
Fix compilation
2017-08-01 23:43:51 +02:00
Jonas Schievink
cb61d53ba5
Fix error message and shorten code
2017-08-01 23:42:42 +02:00
Jonas Schievink
ed6e7ed5e7
Don't dispose whole traceback when it's not utf-8
2017-08-01 23:38:12 +02:00
Jonas Schievink
38a13c906e
Remove "lua" prefix from error messages
...
Since this is `rlua::Error`, it should be clear that it refers to
Lua-related errors. Downstream crates want to define their own error
enums, which can add a prefix like "lua error:" to disambiguate.
2017-08-01 23:23:31 +02:00
Jonas Schievink
bf76e41487
Merge IncompleteStatement into SyntaxError
...
Both are a form of syntax error, this reflects that better. No
functionality is lost, incomplete inputs are moved to a bool field of
SyntaxError.
2017-08-01 23:23:31 +02:00
Jonas Schievink
ed0565c176
Fix handling of CallbackError
...
Previously, the traceback would be printed, but not the actual error.
I've removed traceback printing completely, not sure if that's a good
idea. A `Display` impl that outputs multiple lines feels weird.
2017-08-01 23:23:31 +02:00
Jonas Schievink
7e250dacce
Enhance error messages
2017-08-01 23:23:31 +02:00
kyren
64ac8b4679
Merge pull request #32 from chucklefish/tuples
...
Major API changes before 0.9
2017-08-01 14:52:46 -04:00
kyren
f44917ff83
Replace _: () with () everywhere
2017-08-01 14:09:47 -04:00
kyren
8e9c93b9d1
Formatting, only implement tuple conversion up to 12
2017-08-01 13:57:51 -04:00
kyren
48bf35dc5b
Fix references to hlists in documentation, improve? Variadic usability
...
Also rename to/from/pack/unpack to pack/unpack/pack_multi/unpack_multi, I don't
know if this makes their usage clearer, and it IS a bit confusing that I'm
changing the meaning of the words 'pack' and 'unpack'
2017-08-01 13:55:08 -04:00
kyren
c1abc18066
Merge remote-tracking branch 'origin/master' into tuples
2017-08-01 13:02:58 -04:00
kyren
721ffc462d
Callbacks should be 'static again, fix #33
...
Every time I do lifetime transmutation, I get it wrong.
2017-08-01 12:11:28 -04:00
kyren
d02e32a80a
Remove the rest of the uses of pack / unpack
2017-07-31 01:27:35 -04:00
kyren
4549abbb85
Two major API changes to start with:
...
* Callbacks have generic argument and return types
* All variadics are done with tuples
2017-07-31 01:21:41 -04:00
kyren
8ba3886c96
Merge pull request #31 from jonas-schievink/clone-userdata
...
Relax requirements for UserData to impl FromLua
2017-07-30 14:57:35 -04:00
Jonas Schievink
acabc3ec18
Relax requirements for UserData to impl FromLua
...
This was only allowed for `UserData` implementors that are also `Copy`.
This relaxes the requirement to be `Clone` instead.
While `Copy` makes sense to prevent allocations and other potentially
costly operations, other `FromLua` impls already do pretty expensive
stuff, so this seems worth it.
2017-07-29 15:53:37 +02:00
kyren
387e62580e
Merge pull request #29 from jonas-schievink/errordocs
...
Document `Error`
2017-07-28 10:57:36 -04:00
kyren
ac37b2a0d4
Small typo fix
2017-07-28 10:57:19 -04:00
Jonas Schievink
ad6cf21921
Document Error
...
I didn't yet document *everything* there is to say (in particular, how
exactly custom Rust errors can be passed through Lua), but I've some
changes to this type in mind that I'll do next.
2017-07-28 12:50:30 +02:00
kyren
d415455ccb
Fix several bugs with error handling in xxx_with_traceback functions
...
In resume_with_traceback, always use the coroutine stack for error handling so
we don't miss panics, in both _with_traceback functions remove the temporary
traceback entry from the stack.
2017-07-27 17:16:40 -04:00
kyren
a2b77f37a2
'main_state' fix
...
Dont' confuse the state we're pushing the registry value for the main state to
with the main state itself, pop from the correct state.
2017-07-27 16:47:58 -04:00
kyren
3adacd5589
Merge pull request #27 from jonas-schievink/userdata
...
Few more examples and docs
2017-07-26 12:07:17 -04:00
kyren
8b6425dc39
Clean up lifetimes after LuaCallback typedef change
2017-07-26 11:43:38 -04:00
Jonas Schievink
2b182860f7
Don't use hlist macros in userdata example
2017-07-26 17:28:47 +02:00
Jonas Schievink
f657d301da
Document Lua::create_function
2017-07-26 16:38:10 +02:00
kyren
bf6ef3ecad
Fix wrong name of __newindex metamethod
2017-07-26 10:34:24 -04:00
kyren
eae4c90ead
Fix some compile problems when builtin-lua is disabled
2017-07-26 10:34:24 -04:00
Jonas Schievink
bb662e5a12
Document the UserData trait
2017-07-26 01:55:29 +02:00
kyren
a5ea303c22
Merge pull request #26 from jonas-schievink/strict-examples
...
Deny warnings in doc tests / doc examples
2017-07-25 18:42:56 -04:00
Jonas Schievink
4e52544bd1
Deny warnings in doc tests
...
This magical attribute is grossly underdocumented, but it works. And
it's literally the only thing that makes this work the way I want it to.
2017-07-25 23:41:58 +02:00
Jonas Schievink
df5c8fa4b0
Remove unneeded variable from example
...
Apparently doctests swallow *all* of their output, including compiler
warnings, by default.
2017-07-25 22:58:18 +02:00
kyren
8515db4c82
Merge pull request #24 from jonas-schievink/examples
...
Enhance documentation and add more examples
2017-07-25 00:40:11 -04:00
kyren
8194c4d411
Use stack_guard when the function doesn't return Result
...
Also, simplify some things that used to use error_guard but now are not
2017-07-25 00:37:44 -04:00
kyren
3579b83888
Merge pull request #23 from jonas-schievink/string
...
Beef up the String API
2017-07-25 00:31:56 -04:00
Jonas Schievink
335ecbbac6
tiny typo
2017-07-25 02:13:11 +02:00
Jonas Schievink
54464b0842
AnyUserData docs
2017-07-25 02:11:17 +02:00