Commit graph

24 commits

Author SHA1 Message Date
kyren 61236e685f Change changelog, readme, examples, Cargo.toml for 0.12 release 2018-02-10 19:04:18 -05:00
kyren d0ff10b528 I believe this is all the external API changes necessary for 'm' safety 2017-12-03 23:45:00 -05:00
kyren e7661a5c27 auto-formatting 2017-10-23 16:42:20 -04:00
kyren f44917ff83 Replace _: () with () everywhere 2017-08-01 14:09:47 -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 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
Jonas Schievink 8bd0c2c812 Rename LuaString to String
This required a lot of little adjustments where we used std's `String`
before. In downstream code, this shouldn't be necessary, as you can just
do `use rlua::String as LuaString` to disambiguate.
2017-07-23 18:36:50 +02:00
Jonas Schievink 9df7727eaa Remove the Lua* prefix from most types
cc #15

Doesn't touch `LuaString` mainly because that's a *lot* of renaming work
and the code looks weird. Also I want feedback before I proceed.
2017-07-23 18:36:50 +02:00
kyren 160c5405e1 Add back explanatory comment about trying "return <expr>" before statement
Also run through rustfmt
2017-07-19 20:10:11 -04:00
Jonas Schievink d9098900d1 Give Lua::eval a source name param and simplify 2017-07-16 22:53:32 +02:00
kyren 6f0caa4a6d Update README, small example changes. 2017-06-25 22:25:28 -04:00
kyren d3b311fe49 Another major API change, out of stack space is not an Err
It, ahem "should not" be possible to exhaust lua stack space in normal usage,
and causing stack errors to be Err is slightly obnoxious.  I have been wanting
to make this change for a while, and removing the callback API from tables makes
this sensible *I think*.

I can think of a couple of ways that this is not technically true, but I think
that they are acceptable, or should be handled differently.

One, you can make arbitrarily sized LuaVariadic values.  I think this is maybe a
bug already, because there is an argument limit in Lua which is lower than the
stack limit.  I'm not sure what happens there, but if it is a stack based panic,
(or any panic?) it is a bug.

Two, I believe that if you recurse over and over between lua -> rust -> lua ->
rust etc, and call rlua API functions, you might get a stack panic.  I think for
trusted lua code, this is morally equivalent to a regular stack overflow in
plain rust, which is already.. well it's not a panic but it's some kind of safe
crash I'm not sure, so I think this is acceptable.  For *untrusted* lua code,
this could theoretically be a problem if the API provided a callback that would
call back into lua, then some lua script could force a stack based panic.  There
are so many concerns with untrusted lua code, and this library is NOT safe
enough yet for untrusted code (it doesn't even provide an option to limit lua to
the safe API subset yet!), so this is not currently an issue.  When the library
provides support for "safe lua", it should come with big warnings anyway, and
being able to force a stack panic is pretty minor in comparison.

I think if there are other ways to cause unbounded stack usage, that it is a
bug, or there can be an error just for that situation, like argument count
limits.

This commit also fixes several stupid bugs with tests, stack checking, and
panics.
2017-06-25 17:15:11 -04:00
kyren f0c2f9a870 Method renames, remove ToLua / FromLua impls for Sets
There is no single obvious form for a set in lua, and it is not very difficult
to accept a table and convert the sequence values into a set.

Also rename some methods as per discussion.
2017-06-20 18:04:25 -05:00
Jonas Schievink ed210e88b5 Rename LuaTable::(raw_)length to (raw_)len
All Rust containers use `len` for this. Even in the Lua API, this is
called `lua_len` and `lua_rawlen`.
2017-06-18 14:36:30 +02:00
Jonas Schievink de0f3dc3c0 Rename Lua::load to Lua::exec
When talking about "loading" Lua code, it usually means compiling a
chunk of code into a runnable Lua function, but without actually
running it. This makes that clear.
2017-06-18 14:31:38 +02:00
kyren b02dda3431 that example hardly shows ALL the features 2017-06-15 16:30:16 -04:00
kyren 32c83d77b7 small warning / clippy fixes, doc comments 2017-06-15 16:27:39 -04:00
kyren 0022057058 rustfmt changes 2017-06-15 10:26:39 -04:00
kyren 8440298e71 Go ahead and release 0.5.0
partially for the selfish reason that my submodule setup does not deal well with
ureleased versions of cargo libs where the version number ends with -pre
2017-06-11 01:33:08 -04:00
kyren 5c8aa19b8d Two major API changes:
Allow load to return values, allows reimplementing require() like functions
properly.

Make globals table explicit in Lua, remove Lua::get / Lua::set in favor of
Lua::globals.  Allows obeying globals metatable, using other Table functions on
the globals table.

Also added "has" method as shorthand for checking whether a table entry is not
nil.
2017-06-11 01:12:25 -04:00
kyren b15ee9053e Update to use hlist_macro for hlist macros.
You will type hlist! hlist_pat! and HList! so often that every character
counts.  Apologize for the API churn in the README.
2017-05-22 11:16:34 -04:00
kyren e35cdbfe88 show variadics in examples 2017-05-21 21:57:15 -04:00
kyren c7693ae0a2 Examples and initial README 2017-05-21 21:47:32 -04:00