aboutsummaryrefslogtreecommitdiff
path: root/manual.md
diff options
context:
space:
mode:
Diffstat (limited to 'manual.md')
-rw-r--r--manual.md52
1 files changed, 36 insertions, 16 deletions
diff --git a/manual.md b/manual.md
index 6e775f5c..8ede2785 100644
--- a/manual.md
+++ b/manual.md
@@ -5318,7 +5318,7 @@ import("core.platform.platform", {alias = "p"})
function main()
-- So we can use p to call the plats interface of the platform module to get a list of all the platforms supported by xmake.
- table.dump(p.plats())
+ utils.dump(p.plats())
end
```
@@ -6266,7 +6266,7 @@ local data = io.load("xxx.txt")
if data then
-- Dump prints the contents of the entire table in the terminal, formatting the output
- table.dump(data)
+ utils.dump(data)
end
```
@@ -6377,6 +6377,7 @@ The path operation module implements cross-platform path operations, which is a
| [path.relative](#path-relative) | Convert to relative path | >= 2.0.1 |
| [path.absolute](#path-absolute) | Convert to Absolute Path | >= 2.0.1 |
| [path.is_absolute](#path-is_absolute) | Determine if it is an absolute path | >= 2.0.1 |
+| [path.splitenv](#path-splitenv) | Split a envienment variable value of an array of pathes | >= 2.2.7 |
###### path.join
@@ -6492,6 +6493,24 @@ if path.is_absolute("/tmp/file.txt") then
end
```
+###### path.splitenv
+
+- Split a envienment variable value of an array of pathes
+
+```lua
+local pathes = path.splitenv(vformat("$(env PATH)"))
+
+-- for windows
+local pathes = path.splitenv("C:\\Windows;C:\\Windows\\System32")
+-- got { "C:\\Windows", "C:\\Windows\\System32" }
+
+-- for *nix
+local pathes = path.splitenv("/usr/bin:/usr/local/bin")
+-- got { "/usr/bin", "/usr/local/bin" }
+```
+
+The result is an array of strings, each item is a path in the input string.
+
##### table
Table belongs to the module provided by Lua native. For the native interface, you can refer to: [lua official document](https://www.lua.org/manual/5.1/manual.html#5.5)
@@ -6502,7 +6521,6 @@ It has been extended in xmake to add some extension interfaces:
| ----------------------------------------------- | -------------------------------------------- | -------- |
| [table.join](#table-join) | Merge multiple tables and return | >= 2.0.1 |
| [table.join2](#table-join2) | Merge multiple tables into the first table | >= 2.0.1 |
-| [table.dump](#table-dump) | Output all contents of table | >= 2.0.1 |
| [table.unique](#table-unique) | Deduplicate the contents of the table | >= 2.0.1 |
| [table.slice](#table-slice) | Get the slice of the table | >= 2.0.1 |
@@ -6539,18 +6557,6 @@ table.join2(t, {1, 2, 3})
The result is: `t = {0, 9, 1, 2, 3}`
-###### table.dump
-
-- Output all contents of the table
-
-Recursively format all the contents of the printed table, generally used for debugging, for example:
-
-```lua
-table.dump({1, 2, 3})
-```
-
-The result is: `{1, 2, 3}`
-
###### table.unique
- Deduplicate the contents of the table
@@ -6748,6 +6754,20 @@ for _, procinfo in ipairs(process.waitlist(procs, -1)) do
end
```
+##### utils
+
+###### utils.dump
+
+- Output all contents of the value
+
+Recursively format all the contents of the printed value, generally used for debugging, for example:
+
+```lua
+utils.dump({1, 2, 3})
+```
+
+The result is: `{1, 2, 3}`
+
##### coroutine
The coroutine module is a native module of lua. For use, see: [lua official manual](https://www.lua.org/manual/5.1/manual.html#5.2)
@@ -7663,7 +7683,7 @@ print(platform.get("archs"))
-- Get the target file format information of the specified iphoneos platform
local formats = platform.get("formats", "iphoneos")
-table.dump(formats)
+utils.dump(formats)
```
For specific readable platform configuration information, please refer to: [platform](#platform)