Can I save to a specific folder in Lua & with LÖVE?

While learning how to create Lua output code with LÖVE support, I always hated that the LÖVE file system handler always saved a specific file somewhere in C: / Documents and Settings / ...

How to create code that saves a file to a specific folder that I would like to identify (and possibly change when the application starts)?

+6
source share
1 answer

The love.filesystem library does not allow you to do anything outside of the sandbox. However, LÖVE does not disable Lua, which is built into the io library, so you can use io.open to open files outside the sandbox and read / write them as usual, as well as for other Lua functions such as require and loadfile .

It also does not restrict the loading of external modules, so you can (for example) require "lfs" load the LuaFileSystem and use this if it is installed.

+3
source

Source: https://habr.com/ru/post/957304/


All Articles