diff options
| author | ruki <[email protected]> | 2025-11-15 21:46:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-15 21:46:29 +0800 |
| commit | b250c84aee0072ff92b73fe41403d364f95a03d5 (patch) | |
| tree | 594f1d0be9df3618b48cf734286998483f0895f0 /xmake/core/base/xml.lua | |
| parent | 88b0fb7c39cd6b867cdde29fd195f5f2c49b62d7 (diff) | |
update xml api
Diffstat (limited to 'xmake/core/base/xml.lua')
| -rw-r--r-- | xmake/core/base/xml.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/core/base/xml.lua b/xmake/core/base/xml.lua index 7dc0025b8..5e7282e97 100644 --- a/xmake/core/base/xml.lua +++ b/xmake/core/base/xml.lua @@ -781,13 +781,13 @@ function xml.encode(node, opt) end -- load xml file --- e.g. `local doc, err = xml.load("foo.xml")` +-- e.g. `local doc, err = xml.loadfile("foo.xml")` -- -- @param filepath file path -- @param opt read/decode options -- @return node or nil + error -- -function xml.load(filepath, opt) +function xml.loadfile(filepath, opt) local data, err = io.readfile(filepath, opt) if not data then return nil, err @@ -796,14 +796,14 @@ function xml.load(filepath, opt) end -- save xml node to file --- e.g. `assert(xml.save("foo.xml", node, {pretty = true}))` +-- e.g. `assert(xml.savefile("foo.xml", node, {pretty = true}))` -- -- @param filepath destination file -- @param node xml node -- @param opt encode/write options -- @return true on success or nil + error message -- -function xml.save(filepath, node, opt) +function xml.savefile(filepath, node, opt) local data = xml.encode(node, opt) if not data then return nil, "failed to encode xml" |
