Merge pull request #1150 from revarbat/revarbat_dev

Synopses, etc for structs.scad
This commit is contained in:
Revar Desmera 2023-04-28 18:52:06 -07:00 committed by GitHub
commit 0537baa84c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,9 @@
// An empty list `[]` is an empty structure and can be used wherever a structure input is required. // An empty list `[]` is an empty structure and can be used wherever a structure input is required.
// Function: struct_set() // Function: struct_set()
// Synopsis: Sets one or more key-value pairs in a struct.
// Topics: Data Structures, Dictionaries // Topics: Data Structures, Dictionaries
// See Also: struct_set(), struct_remove(), struct_val(), struct_keys(), echo_struct(), is_struct()
// Usage: // Usage:
// struct2 = struct_set(struct, key, value, [grow=]); // struct2 = struct_set(struct, key, value, [grow=]);
// struct2 = struct_set(struct, [key1, value1, key2, value2, ...], [grow=]); // struct2 = struct_set(struct, [key1, value1, key2, value2, ...], [grow=]);
@ -55,7 +57,9 @@ function struct_set(struct, key, value, grow=true) =
function _format_key(key) = is_string(key) ? str("\"",key,"\""): key; function _format_key(key) = is_string(key) ? str("\"",key,"\""): key;
// Function: struct_remove() // Function: struct_remove()
// Synopsis: Removes one or more keys from a struct.
// Topics: Data Structures, Dictionaries // Topics: Data Structures, Dictionaries
// See Also: struct_set(), struct_remove(), struct_val(), struct_keys(), echo_struct(), is_struct()
// Usage: // Usage:
// struct2 = struct_remove(struct, key); // struct2 = struct_remove(struct, key);
// Description: // Description:
@ -72,7 +76,9 @@ function struct_remove(struct, key) =
// Function: struct_val() // Function: struct_val()
// Synopsis: Returns the value for an key in a struct.
// Topics: Data Structures, Dictionaries // Topics: Data Structures, Dictionaries
// See Also: struct_set(), struct_remove(), struct_val(), struct_keys(), echo_struct(), is_struct()
// Usage: // Usage:
// val = struct_val(struct, key, default); // val = struct_val(struct, key, default);
// Description: // Description:
@ -88,7 +94,9 @@ function struct_val(struct, key, default=undef) =
// Function: struct_keys() // Function: struct_keys()
// Synopsis: Returns a list of keys for a struct.
// Topics: Data Structures, Dictionaries // Topics: Data Structures, Dictionaries
// See Also: struct_set(), struct_remove(), struct_val(), struct_keys(), echo_struct(), is_struct()
// Usage: // Usage:
// keys = struct_keys(struct); // keys = struct_keys(struct);
// Description: // Description:
@ -99,7 +107,9 @@ function struct_keys(struct) = column(struct,0);
// Function&Module: echo_struct() // Function&Module: echo_struct()
// Synopsis: Echoes the struct to the console in a formatted manner.
// Topics: Data Structures, Dictionaries // Topics: Data Structures, Dictionaries
// See Also: struct_set(), struct_remove(), struct_val(), struct_keys(), echo_struct(), is_struct()
// Usage: // Usage:
// echo_struct(struct, [name]); // echo_struct(struct, [name]);
// foo = echo_struct(struct, [name]); // foo = echo_struct(struct, [name]);
@ -120,7 +130,9 @@ module echo_struct(struct,name="") {
// Function: is_struct() // Function: is_struct()
// Synopsis: Returns true if the value is a struct.
// Topics: Data Structures, Dictionaries // Topics: Data Structures, Dictionaries
// See Also: struct_set(), struct_remove(), struct_val(), struct_keys(), echo_struct(), is_struct()
// Usage: // Usage:
// bool = is_struct(struct); // bool = is_struct(struct);
// Description: // Description: