Hi, guys.
If I run the Gideros sample app called "Application Lifecycle" in the desktop Gideros Player, it runs smoothly. If I then click the Gideros Player's "stop" button, the app exits smoothly. However, if I then rerun the app, it crashes with the error:
"attempt to concatenate upvalue 'frame' (a nil value)"
Sometimes it even crashes the Gideros Player.
Why is that?
Kate's Catalogue of Travelling Theatre Centres :Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Comments
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Likes: Platypus
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
I believe that writing/loading files should work properly in the simulator (the desktop Gideros Player) too. I wish it did.
Is there any chance this problem (files not being written/read properly) would occur on handheld devices as well?
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
On the device, you would have triggered the onSuspend or the onExit which would have saved some data for the frames and hence would not have the possibility of an error in comparison.
I guess that the sample should have the "or 0" added to make it more robust. @atilim/@ar2rsawseen ...
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
What concerns me is that "onExit" is indeed properly triggered in the desktop Gideros Player when I click the "stop" icon, and "applicationExit" is printed, but "frame" is still "nil" when I restart the app* - even if I quit both the Gideros Player and Gideros Studio and restart them.
[*If I implement the excellent failsafe you (@OZApps) suggested, "frame" always loads as zero (because it was "nil"); whereas the button starts (as it should) in "resume" mode.]
Either way, the app does not work as an example of how to save data.
It also crashes the Gideros Player four times out of five.
@Atilim? @Ar2rsawseen? et al.?
Cheers, guys.
Platypus
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Maybe you have some sort of restriction, that it create empty file, but can't read values from it, or something like that
Thank you very much for checking. Perhaps it only happens on Mac computers. @Atilim?
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Will try to test more
I am pretty sure it only happens on Mac.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
The truth is, I've been trying to implement this in my app for over a week now, and it never works, no matter what method I try. I think it is a bug in the Mac version of the Gideros Player. Files are not being saved.
All I want to do is bookmark the user's page in my e-book.
When the app starts:
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
And I will notify @atilim about the issue
Likes: Platypus
Thanks, mate.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
The problem on the Mac seems like a timing issue where the data written is unreliable. Insert a couple of print statements, there is some data saved (still not correct)
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
But yes you are right, these are not in Lua docs, so only @atilim could answer that. @OZApps you experience same issue on your Mac? If values changed to proper r and w values, does the problem persist?
I tried to remove the t and run, the problem still persisted, I tried to read the data using '*n' instead of '*number' and at times I could read a number, with the '*number' I would get 'nan' most of the times. There were definitely some timing issues which resulted in saving or not saving the data to file. Though the data stored to the file was different than the value stored in frame.
In my opinion, I would generally have the data stored per line rather than continuous unless it was in binary format 'b'. That way I can read line1 for the frame, ine2 for the paused, etc.
and lastly the fix was simply adding the optional default value to the variable by using 'or 0' fixes a whole lot of things.
Te question that still remains and kind of related with @MrMells questions earlier, is there something related with file io that makes Gideros weak in the knees? In this case it crashes and makes the player unstable (could be a Gideros-Mac related issue).
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Within one month.
C) Within one year.
D) Within one decade.
@Atilim, please type one character (A, B, C or D) and click "Post Comment".
That would be really helpful. Thanks.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Sorry for late reply. Currently, I can produce it on my Mac and trying to understand the exact reason behind. I'll be fixed with the next release therefore the answer is between A and B
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
Likes: gmarinov
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
and I've fixed the bug. it's all related to file write layer.
Likes: Platypus
Likes: Platypus
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
To any future readers of this thread:
If you want to employ an alternative method, the following tutorial by @WauloK is very helpful.
http://bluebilby.com/2013/05/04/gideros-mobile-tutorial-loading-and-saving-data/#codesyntax_2
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
However, the crashing stopped after I ran a few projects using @WauloK's method. It not only miraculously repaired the Gideros Player's crashing problem, it also worked as a method of saving and loading data - both in the Gideros Player and the Xcode simulator.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
When the app starts:
It works perfectly, but the app seems to run sluggishly now. It was so snappy and responsive before. I'm pretty sure I'm not imagining it.
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.