add gettypeid
This commit is contained in:
parent
ea8d3f5a6f
commit
eb1335ade4
1 changed files with 8 additions and 1 deletions
|
@ -110,6 +110,12 @@ pub fn gettype(stack: &mut Stack) -> OError {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn gettypeid(stack: &mut Stack) -> OError {
|
||||
let o = stack.pop();
|
||||
stack.push(Value::Int(o.lock_ro().kind.lock_ro().get_id() as i32).spl());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn barray_new(stack: &mut Stack) -> OError {
|
||||
let Value::Mega(i) = stack.pop().lock_ro().native.clone() else {
|
||||
return stack.err(ErrorKind::InvalidCall("banew".to_owned()));
|
||||
|
@ -1066,7 +1072,7 @@ pub fn from_properties(stack: &mut Stack) -> OError {
|
|||
|
||||
pub fn register(r: &mut Stack, o: Arc<Frame>) {
|
||||
type Fn = fn(&mut Stack) -> OError;
|
||||
let fns: [(&str, Fn, u32); 63] = [
|
||||
let fns: [(&str, Fn, u32); 64] = [
|
||||
("pop", pop, 0),
|
||||
("dup", dup, 2),
|
||||
("dup2", dup2, 3),
|
||||
|
@ -1075,6 +1081,7 @@ pub fn register(r: &mut Stack, o: Arc<Frame>) {
|
|||
("mswap", mswap, 2),
|
||||
("print", print, 0),
|
||||
("gettype", gettype, 1),
|
||||
("gettypeid", gettypeid, 1),
|
||||
("settype", settype, 1),
|
||||
("banew", barray_new, 1),
|
||||
("anew", array_new, 1),
|
||||
|
|
Loading…
Add table
Reference in a new issue