data = dataSaver.loadValue("data")
main.lua:226: attempt to call a nil value
stack traceback:
main.lua:226: in function
It works... mmm... two years ago)
Sorry, i haven't tracked what happened for two years:( It's my fault, I know.
May be anyone knows what should i change to start it works for me?
lua
lua
Comments
Fragmenter - animated loop machine and IKONOMIKON - the memory game
https://wiki.gideros.rocks/index.php/Ftf_snippets#JSON_V2_.40mokalux
maybe?
you should load the json plugin in your project and make datasaver a class or a set of functions as in the attached file.
If I am not mistaken there is also the need to change Json to json (without capital).
I think this should work
Likes: MoKaLux
local tables, err, _
-- catch marker for stringtable
if string.sub( sfile,-3,-1 ) == "--|" then
tables,err = loadstring( sfile )
else
tables,err = loadfile( sfile )
end
print('-----', err, tables, sfile)
it print in Lua, that's correct
----- cannot open |D|sys.dat: No such file or directory nil |D|sys.dat
but in luau, it seems loadfile not work
----- nil |D|sys.dat |D|sys.dat
Just checked and loadfile works here, actually Gideros uses it internally to mimic 'require' call. By the look of the error, it seems to complain that the searched file (sys.dat) doesn't exists in the document folder.I misread your post, sorry, so in both cases it fails, but in luau the error message is absent. Yes it is that way in luau, it just returns nil.
I just hear about luau and have no ideas on how to migrate Lua to luau.
Just searched and found this document
https://luau-lang.org/compatibility
loadfile, dofile removed for sandboxing, no direct file access
Is there some guides on migration to luau if it's not possible to have a Lua release of engine.
I am in the middle of a lua to luau conversion, and gideros so far is telling me every issue one by one just by running the project, fixing the line, rerunning the project and so on.. it's tedious but it's feasible.
Likes: Xman
Likes: Xman
Currently, change
require 'aaaa.bbbb' to require 'aaaa/bbbb'
check if loadfile returned a function or not
make the project run.
I can not guarantee every line of scripts has tested.
So welcome to share your experiences on migrate to luau on the forum.
If everyone shares some experiences, we will have a migrate guide.
Likes: Xman
print(char)
end
gfind is not support in luau
output
attempt to call a nil value
Likes: Xman, pie
And require handling of dots: (https://github.com/gideros/gideros/commit/5a47f8fd12b7caf2fc50213a485bdd93fda974e9)
Likes: MoKaLux, Xman, pie, vitalitymobile