Jump to content

[Default][Client] LocalStorage


Patrix
 Share

Recommended Posts

Introduction

NOTE: This module is installed by default in g2o client directly.

This client-side module allows the server creators to utilize the LocalStorage API for serializing informations. The g2o platform doesn't support the file API from squirrel on client-side due to security reasons, so this project feels the gap of the missing feature. The API usage is very similar to the one from browser (the main inspiration came from it). The code doesn't give the user ability to save/load data, instead it exposes an API to get or set (create/update) values. The API itself will handle the saving data to a file LocalStorage.json, which will be located in this directory: Game/Multiplayer/store/

You can find more information about the exposed API under Exposed API section or in sqmain.cpp file.

Project links:
- Repository
- Download

Usage example

LocalStorage.setItem("nickname", "Patrix")
LocalStorage.setItem("password", "secret")

print("My nickname is: \"" + LocalStorage.getItem("nickname") +"\"")
print("My password is: \"" + LocalStorage.getItem("password") +"\"")
  • Like 2
Link to comment
Share on other sites

  • Patrix changed the title to [Default][Client] LocalStorage

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...