make initial implementation
credit - https://github.com/AlphaModder/include-lua
This commit is contained in:
20
README.md
20
README.md
@@ -11,20 +11,24 @@ and `require` the module.
|
||||
## Synopsis
|
||||
|
||||
```rust
|
||||
use rlua_searcher::AddSearcher;
|
||||
use rlua::Lua;
|
||||
use rlua_searcher::{AddSearcher, Result};
|
||||
use std::collections::HashMap;
|
||||
|
||||
fn main() {
|
||||
let lume = read_lume_to_string();
|
||||
let name = "lume";
|
||||
let map = HashMap::new<String, String>();
|
||||
let name = "lume".to_string();
|
||||
let mut map = HashMap::new();
|
||||
map.insert(name, lume);
|
||||
|
||||
let lua = Lua::new;
|
||||
let lua = Lua::new();
|
||||
|
||||
let hello = lua.context::<_, rlua::Result<_>>(|lua_ctx| {
|
||||
lua_ctx.add_searcher(map)?;
|
||||
Ok(lua_ctx.load(r#"require("lume")"#).eval()?)
|
||||
}).unwrap();
|
||||
let hello = lua
|
||||
.context::<_, Result<String>>(|lua_ctx| {
|
||||
lua_ctx.add_searcher(map)?;
|
||||
Ok(lua_ctx.load(r#"return require("lume")"#).eval()?)
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
// prints "hello lume"
|
||||
println!("{}", hello);
|
||||
|
Reference in New Issue
Block a user