Repository navigation
LuaAPI Config Files
itvnnnd87 edited this page Oct 24, 2026
·
3 revisions
| Path | Relative to |
|---|---|
"Includes\\ABC\\abc.xml" |
The Data\LuaAPI\ folder |
"..\\Data\\Event\\abc.xml" |
Starts with ..: the GameServer folder |
If the file cannot be read, the function returns nil and an error message:
local cfg, err = File.ReadXml("Includes\\ABC\\abc.xml")
if cfg == nil then Log.AddC(1, err) return endFile.ReadXml(path) returns the root tag as:
root = {
name = "TagName", -- tag name
attr = { Attribute = "value" }, -- attributes
kids = { --[[ child tags, same shape ]] },
text = "text inside the tag",
}Attribute values are always strings; use tonumber() when you need a number.
<Reward>
<Item Index="6181" Level="15" Count="1"/>
</Reward>local root = File.ReadXml("Includes\\ABC\\abc.xml")
for _, node in ipairs(root.kids) do
if node.name == "Item" then
local index = tonumber(node.attr.Index)
end
endFile.ReadIni(path) returns { [Section] = { Key = "Value" } }. Lines starting with ; or # are comments. Keys outside any section go into [""].
[Reward]
Rate = 2local ini = File.ReadIni("Includes\\ABC\\abc.ini")
local rate = tonumber(ini["Reward"]["Rate"]) or 1| Function | Description |
|---|---|
File.ReadText(path) |
Table of lines: { "line 1", "line 2", ... }. |
require("ABC\\Config") |
Loads a Lua file once. |
LoadScript("Includes\\ABC\\Config.lua") |
Runs a Lua file every time it is called. |
File.Exists(path) |
true / false. |
Next: Database