cleanup, docs
This commit is contained in:
@@ -5,6 +5,7 @@ bool DValue::is_list() const
|
||||
return value : true when the value is an array with keys 0..n-1
|
||||
|
||||
:see
|
||||
>types
|
||||
0_DValue
|
||||
2_DValue_set_array
|
||||
2_DValue_push
|
||||
@@ -12,8 +13,8 @@ return value : true when the value is an array with keys 0..n-1
|
||||
:content
|
||||
Returns true for map-shaped values that represent a list. An empty map is a list only if it was explicitly put in list mode with `set_array()` or by list operations. Non-empty lists must have canonical numeric string keys from `0` through `size - 1`.
|
||||
|
||||
```cpp
|
||||
DValue first; first = "first";
|
||||
DValue items; items.set_array(); items.push(first);
|
||||
if(items.is_list()) print(json_encode(items));
|
||||
```
|
||||
:example
|
||||
DValue list;
|
||||
DValue item; item = "Ada";
|
||||
list.push(item);
|
||||
print(list.is_list() ? "list\n" : "map\n");
|
||||
|
||||
Reference in New Issue
Block a user