mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-21 10:28:50 +08:00
add native function isa(object,class)
This commit is contained in:
+19
-2
@@ -174,5 +174,22 @@ println(values({
|
||||
c:3
|
||||
}));
|
||||
println(find("cd", "abcdef")); # prints 2
|
||||
println(find("x", "abcdef")); # prints -1
|
||||
println(find("cd", "abcdef")); # prints 2
|
||||
println(find("x", "abcdef")); # prints -1
|
||||
println(find("cd", "abcdef")); # prints 2
|
||||
|
||||
var a={
|
||||
new: func(x=0){
|
||||
return {
|
||||
x:x,
|
||||
parents:[a]
|
||||
};
|
||||
},
|
||||
new2: func(x=0){
|
||||
return {
|
||||
x:x,
|
||||
parents:a
|
||||
};
|
||||
}
|
||||
};
|
||||
println(isa(a.new(),a)); # 1
|
||||
println(isa(a.new2(),a));# 0
|
||||
Reference in New Issue
Block a user