omdl
v0.6.1
OpenSCAD Mechanical Design Library
|
Map data type operations. More...
Files | |
file | datatypes_map.scad |
Map data type operations. | |
Functions | |
function | get_map_i (m, k) |
Return the index of a map key. More... | |
function | map_exists (m, k) |
Test if a key exists. More... | |
function | get_map_v (m, k) |
Get the map value associated with a key. More... | |
function | get_map_kl (m) |
Get a list of all map keys. More... | |
function | get_map_vl (m) |
Get a list of all map values. More... | |
function | get_map_size (m) |
Get the number of map entries. More... | |
module | map_check (m, verbose=false) |
Perform some basic validation/checks on a map. More... | |
module | map_dump (m, sort=true, number=true, p=3) |
Dump each map entry to the console. More... | |
Map data type operations.
Example
Result
function get_map_i | ( | m | , |
k | |||
) |
Return the index of a map key.
m | <matrix-2xN> A list of N key-value map pairs. |
k | <string> A map key. |
key
is not a string or does not exists. function get_map_kl | ( | m | ) |
Get a list of all map keys.
m | <matrix-2xN> A list of N key-value map pairs. |
function get_map_size | ( | m | ) |
Get the number of map entries.
m | <matrix-2xN> A list of N key-value map pairs. |
function get_map_v | ( | m | , |
k | |||
) |
Get the map value associated with a key.
m | <matrix-2xN> A list of N key-value map pairs. |
k | <string> A map key. |
key
. Returns undef if key
does not exists. function get_map_vl | ( | m | ) |
Get a list of all map values.
m | <matrix-2xN> A list of N key-value map pairs. |
module map_check | ( | m | , |
verbose | = false |
||
) |
Perform some basic validation/checks on a map.
m | <matrix-2xN> A list of N key-value map pairs. |
verbose | <boolean> Be verbose during check. |
Check that: (1) each entry has key-value 2-tuple, (2) each key is a string, and (3) key identifiers are unique.
Definition at line 147 of file datatypes_map.scad.
module map_dump | ( | m | , |
sort | = true , |
||
number | = true , |
||
p | = 3 |
||
) |
Dump each map entry to the console.
m | <matrix-2xN> A list of N key-value map pairs. |
sort | <boolean> Sort the output by key. |
number | <boolean> Output index number. |
p | <integer> Number of places for zero-padded numbering. |
Definition at line 221 of file datatypes_map.scad.
function map_exists | ( | m | , |
k | |||
) |
Test if a key exists.
m | <matrix-2xN> A list of N key-value map pairs. |
k | <string> A map key. |