mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 16:49:31 +00:00
Add name and value pair methods
This commit is contained in:
parent
151c70ed26
commit
b93061143c
2 changed files with 23 additions and 0 deletions
|
|
@ -733,6 +733,12 @@ This only works on strings:
|
||||||
|
|
||||||
#### Built-in functions
|
#### Built-in functions
|
||||||
|
|
||||||
|
##### Pair methods
|
||||||
|
|
||||||
|
`name(pair)`: returns the name (first element) of a pair
|
||||||
|
|
||||||
|
`value(pair)`: returns the value (second element) of a pair
|
||||||
|
|
||||||
##### List methods
|
##### List methods
|
||||||
|
|
||||||
`len(list)`: returns length of the list
|
`len(list)`: returns length of the list
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,23 @@ functions = {
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
-- pair methods
|
||||||
|
name = {
|
||||||
|
{
|
||||||
|
arity = 1, types = { "pair" }, mode = "raw",
|
||||||
|
value = function(a)
|
||||||
|
return a.value[1]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value = {
|
||||||
|
{
|
||||||
|
arity = 1, types = { "pair" }, mode = "raw",
|
||||||
|
value = function(a)
|
||||||
|
return a.value[2]
|
||||||
|
end
|
||||||
|
}
|
||||||
|
},
|
||||||
-- list methods
|
-- list methods
|
||||||
len = {
|
len = {
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue