diff --git a/doc/menu_lua_api.md b/doc/menu_lua_api.md index 8f945052c..df14b859d 100644 --- a/doc/menu_lua_api.md +++ b/doc/menu_lua_api.md @@ -8,6 +8,15 @@ The main menu is defined as a formspec by Lua in `builtin/mainmenu/` Description of formspec language to show your menu is in `lua_api.md` +Images and 3D models +------ + +Directory delimiters change according to the OS (e.g. on Unix-like systems +is `/`, on Windows is `\`). When putting an image or a 3D model inside a formspec, +be sure to sanitize it first with `core.formspec_escape(img)`; otherwise, +any resource located in a subpath won't be displayed on OSs using `\` as delimiter. + + Callbacks --------- @@ -62,6 +71,12 @@ Functions Filesystem ---------- +To access specific subpaths, use `DIR_DELIM` as a directory delimiter instead +of manually putting one, as different OSs use different delimiters. E.g. +```lua +"my" .. DIR_DELIM .. "custom" .. DIR_DELIM .. "path" -- and not my/custom/path +``` + * `core.get_builtin_path()` * returns path to builtin root * `core.create_dir(absolute_path)` (possible in async calls)