Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/therustmonk/lua-macros
Lua Macros for Rust programming language
https://github.com/therustmonk/lua-macros
Last synced: 2 days ago
JSON representation
Lua Macros for Rust programming language
- Host: GitHub
- URL: https://github.com/therustmonk/lua-macros
- Owner: therustmonk
- License: apache-2.0
- Created: 2016-07-28T11:06:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-18T13:09:42.000Z (over 7 years ago)
- Last Synced: 2025-01-02T21:12:36.705Z (6 days ago)
- Language: Rust
- Size: 19.5 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Lua-macros library
This library provides useful macros to simplify embedding Lua to Rust.
It's based on [`lua`](https://github.com/jcmoyer/rust-lua53) crate.Example:
```rust
#[macro_use]
extern crate lua_macros;
use lua_macros::lua::{State, Integer};#[derive(Clone, Debug, PartialEq)]
enum UserEnum {
One,
Two,
Three,
}lua_userdata!(UserEnum);
fn main() {
let mut state = State::new();
UserEnum::attach(&mut state);let ud = UserEnum::One;
state.push(ud);
state.push_nil();let restored = state.to_type::(-2).unwrap();
let wrong = state.to_type::(-1);assert_eq!(restored, UserEnum::One);
assert!(wrong.is_none());
}
```## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.