update license year to 2023
update dependencies
enforce at least one version of fennel be chosen
Require Fennel modules by name at runtime.
If you wish to accept the default Fennel release version provided by fennel-src:
[dependencies]
fennel-searcher = "*"
If you wish to specify a Fennel release version:
# basic
[dependencies]
fennel-searcher = { version = "*", default-features = false, features = ["fennel100"] }
# advanced
[features]
default = ["fennel100"]
fennel100 = ["fennel-searcher/fennel100"]
[dependencies]
fennel-searcher = { version = "*", default-features = false }
use fennel_searcher::AddSearcherFnl;
use rlua::Lua;
use std::borrow::Cow;
use std::collections::HashMap;
use std::path::PathBuf;
fn main() {
let lime = Cow::from("lime/color");
let color = PathBuf::new()
.join(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("testcrate")
.join("lime")
.join("color.fnl");
let mut map = HashMap::new();
map.insert(lime, color);
let lua = Lua::new();
let color = lua.context::<_, String>(|lua_ctx| {
lua_ctx.add_path_searcher_fnl(lime).unwrap();
lua_ctx
.load(r#"return require("lime/color")"#)
.eval()
.unwrap()
});
assert_eq!(&color, "green");
}
Licensed under either of
at your option.
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.