π Quick Start Guide for file and folder operations with LuaDoTheWorld
- β How to load and write files
- β How to copy and move files or folders (overwrite or merge)
- LuaDoTheWorld installed and required in your script
local dtw = require("luaDoTheWorld/luaDoTheWorld")
local content = dtw.load_file("tests/target/a.txt")
print(content)local dtw = require("luaDoTheWorld/luaDoTheWorld")
dtw.write_file("tests/target/b.txt", "text content")This will copy a file or folder, overwriting whatever is at the destination.
local dtw = require("luaDoTheWorld/luaDoTheWorld")
dtw.copy_any_overwriting("tests/target/test_dir", "tests/target/a")This will copy and merge folders if the destination is a folder.
local dtw = require("luaDoTheWorld/luaDoTheWorld")
dtw.copy_any_merging("tests/target/test_dir", "tests/target/a")This will move a file or folder, removing the destination if it exists.
local dtw = require("luaDoTheWorld/luaDoTheWorld")
dtw.move_any_overwriting("tests/target/test_dir", "tests/target/a")This will move and merge folders if the destination is a folder.
local dtw = require("luaDoTheWorld/luaDoTheWorld")
dtw.move_any_merging("tests/target/test_dir", "tests/target/a")| Function | What it does | Example |
|---|---|---|
dtw.load_file(path) |
Load file content | dtw.load_file("a.txt") |
dtw.write_file(path, data) |
Write content to file | dtw.write_file("b.txt", "text") |
dtw.copy_any_overwriting(src, dest) |
Copy and overwrite | dtw.copy_any_overwriting("dir", "a") |
dtw.copy_any_merging(src, dest) |
Copy and merge | dtw.copy_any_merging("dir", "a") |
dtw.move_any_overwriting(src, dest) |
Move and overwrite | dtw.move_any_overwriting("dir", "a") |
dtw.move_any_merging(src, dest) |
Move and merge | dtw.move_any_merging("dir", "a") |
- π Check the main SDK documentation
- π Look at other example scripts in the SDK
- π Report issues on our GitHub repository