Assets¶
-
knLoadAsset(resPath:
string):string|nil¶ Load the contents of an asset from the APK’s assets directory.
This uses Smash Hit’s asset manager, so filenames transparently have
.mp3appended when loading from the APK, localised assets are loaded automatically,.gz.mp3files are automatically decompressed, anduser://andhttp://paths are also valid. Note that this now requires excluding the.mp3for files loaded from the APK assets, whereas in r12 they were allowed.Returns the contents of the asset as a string, or
nilif the asset could not be loaded.
-
knListAssetDir(path:
string):table[string]¶ Return a table with a list of filenames that would be returned by AAssetDir_getNextFileName() on a directory opened with AAssetManager_openDir() using
pathas the path. This essentially lists folders in the asset directory of the APK, and it is not aware of overlays or the resource manager. It will always use the real asset directory’s contents.Raises an error when any error is encountered.
Added in version 17.