Hi everyone…
I have read many post for saving data, highs core, sounds…
Now it’s the time to really learn this, and understand it.
I have the code Rob post here…
https://github.com/robmiracle/Simple-Table-Load-Save-Functions-for-Corona-SDK
the loadsave.lua file – with the local M = { } and – local json = require(“json”)
if you need the complete code I will put it here also…
So I have that file in my folder.
in my main.lua file I have this
local loadsave = require("loadsave") local t = {} t.number = 10 t.string = "Hello World" t.bool = true t.table = { someOtherString = "this is a test", someOtherNumber = 5} loadsave.saveTable(t, "myTable.json", system.DocumentsDirectory) newTable = loadsave.loadTable("myTable.json", system.DocumentsDirectory) loadsave.printTable(newTable)
before going to my main — storyboard.gotoScene( “home” )
Now in my – settings.lua (another file) I only have this in the createScene
function scene:createScene( event ) local group = self.view txtSoundOn = display.newText( "Sound On", 0, 0, native.systemFont, 18 ) group:insert(txtSoundOn) txtSoundOn.x = display.contentCenterX txtSoundOn.y = display.contentCenterY - 50 txtSoundOn:setFillColor(1, 1, 1, 1) local function txtSoundOnListener () print("this turns music On") redBox.x = display.contentCenterX + 100 redBox.y = display.contentCenterY - 50 end txtSoundOn:addEventListener("tap", txtSoundOnListener) txtSoundOff = display.newText( "Sound Off", 0, 0, native.systemFont, 18 ) group:insert(txtSoundOff) txtSoundOff.x = display.contentCenterX txtSoundOff.y = display.contentCenterY + 50 txtSoundOff:setFillColor(1, 1, 1, 1) local function txtSoundOffListener () print("this turns music Off") redBox.x = display.contentCenterX + 100 redBox.y = display.contentCenterY + 50 end txtSoundOff:addEventListener("tap", txtSoundOffListener) redBox = display.newRect( 0, 0, 10, 10 ) group:insert(redBox) redBox.x = display.contentCenterX + 100 redBox.y = display.contentCenterY - 50 redBox:setFillColor( 1, 0, 0, 1 ) end
A simple text On and Off with a red box to move up or down next to the On and Off text.
How do I really make this to work?
– where Do I call – M.saveTable( )
– when the app start the music is On by default
then in the function
local function txtSoundOffListener () print("this turns music Off") redBox.x = display.contentCenterX + 100 redBox.y = display.contentCenterY + 50 end txtSoundOff:addEventListener("tap", txtSoundOffListener)
what do I write?
please I really appreciate all the help to really understand this important concept
after almost 2 years of working with Corona, I think I should be ready for this step
Thanks for all your time to help me out – (and others who also will read this)
–**-- [62 Views and 0 reply] --**-- ( on Thursday July 10 at 10:36 ) --**–
either nobody knows the answer…
or the post is too long and they don’t really read it…
or they just don’t understand the question, and I need to be more specific…
Let’s see in a few days…
–**-- [67 Views and 0 reply] --**-- ( on Friday July 11 at 11:57 ) --**–
still no answer…
Let’s see in a few days…
–**-- [80 Views and 0 reply] --**-- ( on Monday July 14 at 5;09 pm ) --**–
still no answer…
well…