The forum on this site is closed for new comments and posts. Continue the conversation in the new forum, and learn more here.

error with putString

  • Hey UAEpro,

    Thanks for the note! Do you by chance have a code snippet or reproduction steps?

    Thanks in advance!

    Jonathan

    Comment actions Permalink
  • Thanks for your interest Jonathan Solichin

    edited: nvm it worked, the guide lack of some information which may lead to confuse some things.

    working example

    var store = global.persistentStorageSystem.store;
    var word = "word";
    var currentWord = store.getString(word);

    function init(){
    currentWord = "Word A"
    store.putString(word,currentWord)
    print(currentWord)
    }

    replacedWord()
    currentWord = "Word B"
    store.putString(word,currentWord)
    print(currentWord)
    }

    init()

    not working example

    var store = global.persistentStorageSystem.store; 
    var word = "word";
    var currentWord = store.getString(word);

    function init(){
    store.putString(word,"Word A")
    print(currentWord)
    replacedWord()

    }

    function replacedWord(){
    store.putString(word,"word B")
    print(currentWord)
    }
    init()

    Thanks for your amazing work Lens studio team, but if you could increase the size of the storage or at least the size 3072 in which scale I mean it's byte or kb

    ---------------------------

    for example

        store.putString(storeCurrentStringOrder,JSON.stringify(list));

     

    then i need to reset storeCurrentStringOrder so what i do is

    store.putString(storeCurrentStringOrder,'')

     

    but it doesn't override.

    even if you assisgn a string and then in the next line you try to override it, it doesn't work and

    store.getString(storeCurrentStringOrder)

    doesn't print the second value, just the first one, but with putInt everything was working fine.

    I will try to make example project once i get home

    Comment actions Permalink
  • Hello Jonathan Solichin,

    I'm afraid that there is some strange problem with the storage system.

    store = global.persistentStorageSystem.store
    var storeQuestionArray = "QuestionArray";
    var currentQuestionArray = store.getIntArray(storeQuestionArray);

     

    and this is the function

    function help1(){
    currentQuestionArray = chosenQuestion // the value of chosenQuestion is [100,46,434,146,154]
    store.putIntArray(storeQuestionArray,currentQuestionArray)
    currentQuestionArray = store.getIntArray(storeQuestionArray)
    print("cuurentQuestionArray = " + currentQuestionArray) // the output is [100,46,434,146,154]
    }

    but when pressing the print storage button, the output is nothing ... this is very strange

    Olha if you can help me here please :)

     

    edit: after verification, there is problem with array.. i just used JSON.stringify()

    Comment actions Permalink
  • Hi, UAEpro!

    I am checking out this code of yours:

    var store = global.persistentStorageSystem.store; 
    var word = "word";
    var currentWord = store.getString(word);

    function init(){
    store.putString(word,"Word A")
    print(currentWord)
    replacedWord()

    }

    function replacedWord(){
    store.putString(word,"word B")
    print(currentWord)
    }
    init()

    So the reason of the problem might be in the fact that  currentWord variable is not updated after you put some value into the store. String 

    Please try this instead : 

    var store = global.persistentStorageSystem.store; 
    var word = "word";
    var currentWord = store.getString(word);

    function init(){
    store.putString(word,"Word A");
    currentWord = store.getString(word);
    print("Current word: " + currentWord)
    replacedWord();

    }

    function replacedWord(){
    store.putString(word,"word B")
    currentWord = store.getString(word);
    print("Updated word: " + currentWord)
    }
    init()

    Let me know if it works !

    As for the example with arrays could you please provide the minimal not working project?

    Because if I am adding initialization to the chosenQuestion variable it works for me.

    My Code: 

    store = global.persistentStorageSystem.store
    var storeQuestionArray = "QuestionArray";
    var currentQuestionArray = store.getIntArray(storeQuestionArray);

    var chosenQuestion = [100,46,434,146,154]

    function help1(){
    currentQuestionArray = chosenQuestion // the value of chosenQuestion is [100,46,434,146,154]
    store.putIntArray(storeQuestionArray,currentQuestionArray)
    currentQuestionArray = store.getIntArray(storeQuestionArray)
    print("cuurentQuestionArray = " + currentQuestionArray) // the output is [100,46,434,146,154]
    }

    help1()

    My output :

    11:46:47 cuurentQuestionArray = 100,46,434,146,154

    Best 

    Olha

    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?

Version

Graphics

Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:

Name:

Email:

What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!