I feel like I’m doing something wrong, I can’t seem to read a custom resource from lua code using sys.load_resource()
. I’ve managed to reproduce this in a minimal test case.
Method
Using the latest editor on Linux:
- Created a new blank project
- Added a folder in the project root named
assets
- Create a file named
words
in the folder with some text content - Add
assets/words
to custom_resources in thegame.project
file - Create a new script
- Add a game object and the script to the collection
- Add the following lines to the init function of the script and build the project
local test, error = sys.load_resource("/assets/words")
print(test)
print(error)
What I expected
When run the contents of the file should be output, followed by nil
What happened
The content is nil, and the error reads:
Failed to load resource: /assets/words (-3)
I’ve attached a zip with the project: Resource.zip (3.0 KB)
What am I doing wrong here? Or have I found a bug?