Add get/set/index_get/index_set parameters to rhai_fn.

This commit is contained in:
Stephen Chung
2020-08-17 00:13:52 +08:00
parent e75d91e9bf
commit 810514dd31
5 changed files with 53 additions and 15 deletions

View File

@@ -140,7 +140,7 @@ mod array_functions {
#[cfg(not(feature = "no_object"))]
#[export_module]
mod object_functions {
#[rhai_fn(name = "get$len")]
#[rhai_fn(get = "len")]
pub fn len(list: &mut Array) -> INT {
array_functions::len(list)
}

View File

@@ -24,7 +24,7 @@ mod map_functions {
pub fn len(map: &mut Map) -> INT {
map.len() as INT
}
#[rhai_fn(name = "get$len")]
#[rhai_fn(get = "len")]
pub fn len_prop(map: &mut Map) -> INT {
len(map)
}

View File

@@ -342,7 +342,7 @@ mod index_functions {
#[cfg(not(feature = "no_object"))]
#[export_module]
mod object_functions {
#[rhai_fn(name = "get$len")]
#[rhai_fn(get = "len")]
pub fn len(s: &mut ImmutableString) -> INT {
string_functions::len(s)
}