Capy-Bearer Documentation

Get a child by path

lib call

Capy

function get_by_path(value : any, path : string) any

Description

get_by_path(value, path) reads a nested child without creating nodes. Use a slash between path segments.

Parameters

value : source value

path : slash-separated child path

Return Values

The child itself, or an empty string value when the path fails.

Example

Capy

var config := {"site": {"title": "Bearer"}}
print(get_by_path(config, "site/title"), "\n")

Output

Bearer