mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-25 03:29:58 -07:00
merge mjs
This commit is contained in:
@@ -475,6 +475,22 @@ static int getprop_builtin_string(
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int getprop_builtin_number(
|
||||
struct mjs* mjs,
|
||||
mjs_val_t val,
|
||||
const char* name,
|
||||
size_t name_len,
|
||||
mjs_val_t* res) {
|
||||
if(strcmp(name, "toString") == 0) {
|
||||
*res = mjs_mk_foreign_func(mjs, (mjs_func_ptr_t)mjs_number_to_string);
|
||||
return 1;
|
||||
}
|
||||
|
||||
(void)val;
|
||||
(void)name_len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int getprop_builtin_array(
|
||||
struct mjs* mjs,
|
||||
mjs_val_t val,
|
||||
@@ -589,6 +605,8 @@ static int getprop_builtin(struct mjs* mjs, mjs_val_t val, mjs_val_t name, mjs_v
|
||||
} else if(s != NULL && n == 5 && strncmp(s, "apply", n) == 0) {
|
||||
*res = mjs_mk_foreign_func(mjs, (mjs_func_ptr_t)mjs_apply_);
|
||||
handled = 1;
|
||||
} else if(mjs_is_number(val)) {
|
||||
handled = getprop_builtin_number(mjs, val, s, n, res);
|
||||
} else if(mjs_is_array(val)) {
|
||||
handled = getprop_builtin_array(mjs, val, s, n, res);
|
||||
} else if(mjs_is_foreign(val)) {
|
||||
|
||||
Reference in New Issue
Block a user