Working with LUA
Last updated
---
country: Australia # this place
cities:
- Sydney
- Melbourne
- Brisbane
- Perthyq -o=lua '.' sample.ymlreturn {
["country"] = "Australia"; -- this place
["cities"] = {
"Sydney",
"Melbourne",
"Brisbane",
"Perth",
};
};---
country: Australia # this place
cities:
- Sydney
- Melbourne
- Brisbane
- Perthyq -o=lua --lua-unquoted '.' sample.ymlreturn {
country = "Australia"; -- this place
cities = {
"Sydney",
"Melbourne",
"Brisbane",
"Perth",
};
};---
country: Australia # this place
cities:
- Sydney
- Melbourne
- Brisbane
- Perthyq -o=lua --lua-globals '.' sample.ymlcountry = "Australia"; -- this place
cities = {
"Sydney",
"Melbourne",
"Brisbane",
"Perth",
};---
hello: world
tables:
like: this
keys: values
? look: non-string keys
: True
numbers:
- decimal: 12345
- hex: 0x7fabc123
- octal: 0o30
- float: 123.45
- infinity: .inf
plus_infinity: +.inf
minus_infinity: -.inf
- not: .nan
yq -o=lua '.' sample.ymlreturn {
["hello"] = "world";
["tables"] = {
["like"] = "this";
["keys"] = "values";
[{
["look"] = "non-string keys";
}] = true;
};
["numbers"] = {
{
["decimal"] = 12345;
},
{
["hex"] = 0x7fabc123;
},
{
["octal"] = 24;
},
{
["float"] = 123.45;
},
{
["infinity"] = (1/0);
["plus_infinity"] = (1/0);
["minus_infinity"] = (-1/0);
},
{
["not"] = (0/0);
},
};
};