mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Docs for core.file_exists
This commit is contained in:
parent
74a4801e29
commit
d9c317849e
2 changed files with 9 additions and 0 deletions
|
@ -872,3 +872,9 @@ function core.parse_coordinates(x, y, z, relative_to)
|
||||||
local rz = core.parse_relative_number(z, relative_to.z)
|
local rz = core.parse_relative_number(z, relative_to.z)
|
||||||
return rx and ry and rz and { x = rx, y = ry, z = rz }
|
return rx and ry and rz and { x = rx, y = ry, z = rz }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function core.file_exists(path)
|
||||||
|
local file = io.open(path, "r")
|
||||||
|
if file then file:close() return true end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
|
@ -4317,6 +4317,9 @@ Helper functions
|
||||||
* `tool_capabilities`: Tool capabilities table of the item
|
* `tool_capabilities`: Tool capabilities table of the item
|
||||||
* `time_from_last_punch`: time in seconds since last punch action
|
* `time_from_last_punch`: time in seconds since last punch action
|
||||||
* `wear`: Amount of wear the item starts with (default: 0)
|
* `wear`: Amount of wear the item starts with (default: 0)
|
||||||
|
* `core.file_exists(path)`
|
||||||
|
* Returns true if a file exists
|
||||||
|
* Use if you only want to check if a file exists, don't use to check if you can open it (example: you can check if a schematic exists before loading it)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue