Jonas Schievink
16ae4720d6
Rename `LuaString::get` to `to_str`
...
This is what similar types in libstd do (`CStr::to_str`,
`OsStr::to_str`, `Path::to_str`).
2017-06-18 14:48:45 +02:00
Jonas Schievink
a47a6e32ef
Rename `LuaTable::has` to `contains_key`
...
This is what all Rust maps use
2017-06-18 14:39:18 +02: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
ba9f7a2ee7
Add mostly untested missing metamethods, improve documentation about them
2017-06-18 00:28:55 -04:00
kyren
56a30fba2e
Slightly more palatable coroutine API
2017-06-17 23:50:40 -04:00
kyren
4d34ccdba1
Merge pull request #9 from jonas-schievink/docs
...
Documentation
2017-06-17 23:28:13 -04:00
kyren
64d1eae55c
New 0.5.x cargo update with important coroutine bugfix, build changes
2017-06-17 23:23:17 -04:00
kyren
edc5fc8ce3
ACTUALLY check the status of lua threads before calling resume
2017-06-17 22:40:09 -04:00
Jonas Schievink
0e14d787b7
Documentation
2017-06-18 03:31:20 +02:00
kyren
7b00ff02f2
enable more lua platform defines in build.rs
2017-06-17 16:56:36 -04:00
kyren
75b7024a93
Merge pull request #7 from jonas-schievink/popen
...
Enable `io.popen` on Linux
2017-06-17 16:31:09 -04:00
Jonas Schievink
4a980de0ed
Allow multiline input in the REPL example
2017-06-17 14:43:05 +02:00
Jonas Schievink
2cddfecfb2
Enable `io.popen` on Linux
2017-06-17 01:53:51 +02:00
Jonas Schievink
4f05516783
Add a simple repl example
2017-06-17 01:19:21 +02:00
kyren
b02dda3431
that example hardly shows ALL the features
2017-06-15 16:30:16 -04:00
kyren
44370dd64e
bump cargo version, nice addition of Result conversion
2017-06-15 16:28:12 -04:00
kyren
32c83d77b7
small warning / clippy fixes, doc comments
2017-06-15 16:27:39 -04:00
kyren
484479477b
Merge pull request #4 from jonas-schievink/result-to-lua-dejavu
...
Allow passing `Result<T, E>` to Lua
2017-06-15 15:59:20 -04:00
kyren
0d652a3c94
Merge pull request #5 from jonas-schievink/who-needs-macros
...
Remove src/macros.rs
2017-06-15 15:55:54 -04:00
kyren
fc9164ab9f
Merge pull request #6 from jonas-schievink/cfg_attr
...
Utilize `cfg_attr` instead of duplicating code
2017-06-15 15:55:06 -04:00
kyren
0022057058
rustfmt changes
2017-06-15 10:26:39 -04:00
Jonas Schievink
6b651820b6
Utilize `cfg_attr` instead of duplicating code
2017-06-14 01:30:33 +02:00
Jonas Schievink
5019396bd7
Remove src/macros.rs
...
It's not used by anything. It's not even included via `mod macros;`.
2017-06-14 01:24:38 +02:00
Jonas Schievink
80be9e8091
Allow passing `Result<T, E>` to Lua
...
For this to work, both `T` and `E` need to implement `ToLua`. An `Ok(t)`
passes the contained `T`, while an `Err(e)` passes `nil` followed by the
contained `E`. This matches the common Lua idiom used by functions like
`io.open`.
Closes #3
2017-06-14 01:17:41 +02: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
8203414b76
Use LUA_RIDX_MAINTHREAD instead of weird bespoke method
2017-06-05 05:03:18 -04:00
kyren
7436e84e93
make sure other table methods do not trigger metamethods and errors
2017-06-05 04:10:54 -04:00
kyren
cb7c55f742
Don't need pub on internal function
2017-06-05 01:51:48 -04:00
kyren
1c0b1014ee
Improve performance of create_table / create_array_table
2017-06-05 01:46:45 -04:00
kyren
9aed99e3e3
atpanic function was not a good idea, it's not sound
...
It crosses the C api boundary, the only proper way to panic would be to actually
error guard everywhere, aborting is fine.
2017-06-05 01:05:41 -04:00
kyren
b3218137e1
Somewhat smarter strategy for error_guard calls, less ungodly slow.
...
Also add raw_length table function
2017-06-05 00:41:48 -04:00
kyren
e4052bb4d4
Bump cargo.toml version number
2017-06-05 00:06:15 -04:00
kyren
47d4ea62ff
Handle unprotected lua errors SOMEWHAT more elegantly
...
There should be drastically less ways to cause unprotected lua errors now, as
the LuaTable functions which were trivial to cause unprotected errors are now
protected. Unfortunately, they are protected in a pretty slow, terrible way
right now, but it at least works.
Also, set the atpanic function in lua to call a proper rust panic instead.
2017-06-05 00:03:39 -04:00
kyren
bd7ee783e3
fix links, again
2017-05-29 16:34:39 -04:00
kyren
ab3f75a90d
bump cargo version
2017-05-29 16:33:54 -04:00
kyren
dbc7144ba9
remove stray lib.rs file
2017-05-29 16:33:14 -04:00
kyren
87e3e56ae3
Fix link
2017-05-29 16:30:43 -04:00
kyren
4deb90c1ef
Update README / Cargo.toml to point to docs.rs API docs
2017-05-29 16:28:29 -04:00
kyren
9c4029c04c
bump cargo version
2017-05-26 23:49:49 -04:00
kyren
e265633fb3
Callback versions of table functions
2017-05-26 23:49:12 -04:00
kyren
53b001cfce
doc update again to test submodules
2017-05-25 12:12:12 -04:00
kyren
c88762e90f
Small doc update (secretly this is just to test submodules)
2017-05-25 12:01:12 -04:00
kyren
e73346bc0f
version bump
2017-05-25 00:58:28 -04:00
kyren
9fef45272f
update README
2017-05-25 00:56:23 -04:00
kyren
acd0611692
Make Lua::to / Lua::from operate the correct way around
...
I know that Lua::to uses FromLua and Lua::from uses ToLua, but it only
makes sense that Lua::from(42) would return the LuaValue for 42, and
that Lua::to::<i64>(v) would convert the given lua value TO an integer.
The way it was just incredibly backwards.
2017-05-25 00:47:48 -04:00
kyren
87a395206d
Correct checking of LuaRef origin, support lightuserdata
...
All lua types should now be at least somewhat usable from rust, if
incompletely so. Any lua value should be readable in Rust as a
LuaValue, pop_value should never panic except in internal logic errors.
2017-05-25 00:43:35 -04:00
kyren
0111625d17
Basic coroutine support, currently very slightly broken
...
There is no longer any protection in passing LuaValue between
independent states, it is being re-added
2017-05-24 23:29:57 -04:00
kyren
f2b6de8e62
show build status in readme
2017-05-22 23:24:30 -04:00
kyren
151d830bf4
Add travis-ci script
2017-05-22 23:00:32 -04:00
kyren
7dc7d8edbe
Update README
2017-05-22 18:09:22 -04:00
kyren
5c0f183a52
Improved error handling and formatting
...
Now prints lua backtraces on callback errors as well. This could be
controlled with LUA_BACKTRACE or just RUST_BACKTRACE or similar.
2017-05-22 14:25:36 -04:00
kyren
c0ecc39fc7
grammar fix for README
2017-05-22 11:46:48 -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
9bed8f499f
Merge pull request #1 from jhasse/patch-1
...
Remove 2 spaces from Markdown lists
2017-05-22 10:59:14 -04:00
Jan Niklas Hasse
7282a3f640
Remove 2 spaces from Markdown lists
...
This improves rendering of the README.md since 4 spaces intends get treated as code.
2017-05-22 16:52:32 +02:00
kyren
ccc83767ec
Updates to Cargo.toml metadata
2017-05-22 03:06:33 -04:00
kyren
29b0f02472
fix typo
2017-05-21 23:34:47 -04:00
kyren
f401a7043d
More sensible license, show that copyright is to Chucklefish LTD
2017-05-21 22:58:47 -04:00
kyren
edb86bdeb7
Doc updates, remove unused functions
2017-05-21 22:32:16 -04:00
kyren
c8e83ac347
README edits
2017-05-21 22:06:23 -04:00
kyren
1d31a38d0c
talk a bit about safety
2017-05-21 22:04:32 -04:00
kyren
e35cdbfe88
show variadics in examples
2017-05-21 21:57:15 -04:00
kyren
895dcc8c66
more readme stuff
2017-05-21 21:52:14 -04:00
kyren
a027ad43a5
extremely bad at it
2017-05-21 21:51:25 -04:00
kyren
5356dfc87c
I'm bad at md formatting
2017-05-21 21:49:15 -04:00
kyren
c7693ae0a2
Examples and initial README
2017-05-21 21:47:32 -04:00
kyren
065c69894a
Initial import
2017-05-21 19:50:59 -04:00