slaimmials Posted October 25, 2023 Share Posted October 25, 2023 How to load table from saved file by gg.saveVariable(), local var = assert(loadfile("directory"))() not work Link to comment Share on other sites More sharing options...
Count_Nosferatu Posted October 25, 2023 Share Posted October 25, 2023 Quote from https://www.lua.org/manual/5.1/manual.html Quote 5.1 – Basic Functions The basic library provides some core functions to Lua. If you do not include this library in your application, you should check carefully whether you need to provide implementations for some of its facilities. assert (v [, message]) Issues an error when the value of its argument v is false (i.e., nil or false); otherwise, returns all its arguments. message is an error message; when absent, it defaults to "assertion failed!" Small change to a line from documentation local configFile = gg.getFile()..'.cfg' -- local var = assert(loadfile("directory"))() local var = assert(loadfile(configFile), ' CONFIG FILE NOT FOUND !!! :-( ')() If .cfg file does'nt exist, we will receive an error message: Script ended: Script error: luaj.o: /storage/emulated/0/....../test-assert.lua:5 `local var = assert(loadfile(configFile), ' CONFIG FILE NOT FOUND !!! ')()` CONFIG FILE NOT FOUND !!! (global 'assert') ..blah.. blah.. blah.. An example script looks like: Examples of Lua scripts (#1lj25n68) Link to comment Share on other sites More sharing options...
Question
slaimmials
How to load table from saved file by gg.saveVariable(), local var = assert(loadfile("directory"))() not work
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.