Encrypt.dll
Attention: This page contains dead links!
Encrypt is a closed library which allows encrypted saving of data.
Unlike the Data class, you can only save natural numbers to encrypted data files.
Requires bitwise.lua (A Deprecated API)
Installation
Place the file encrypt.dll into the LuaScriptsLib folder.
How to use
To enable the Encrypt library for a specific level, add this line to lunadll.lua:
local encrypt = API.load("encrypt");
This will load the Encrypt API.
Example
local encrypt = API.load("encrypt");
--Defines a new encrypted data file
local edata = encrypt.Data(Data.DATA_LEVEL, "encryptedData", true);
function onStart()
edata:set("myVar", 1);
edata:save();
end
function onTick()
Text.print(tostring(edata:get("myVar")),3,0,0);
end
This will save the value 1 to the variable myVar, as with the Data class, but will encrypt the data so it cannot be easily edited from the resulting text file.
Documentation
Classes
These are classes contained within this library
EData
Values
| EData.data | The underlying Data file used to read and write encrypted data. (NOT NECESSARY FOR USE). |
|---|
Functions
| EData:get | key | ||
|---|---|---|---|
| Reads a value from the encrypted file. Returns nil if no value was found. | int | string
The variable name to read from the encrypted file. | |
| EData:set | key | value | |
| Writes a value to the encrypted file. | int | string
The variable name to write to the encrypted file. |
int
The value to store in this key. |
| EData:save | |||
| Flushes data to the file on the disk. | nil | ||
| EData.create | data | ||
| Create a new encrypted file handler from an existing file handler. | EData | Data
The file handler to create an encrypted stream to. |
External Use Functions
These are functions you will need to use the library
| Data | dataLevel | fileName | localSave | |
|---|---|---|---|---|
| Creates an EData file handler for the specified file name, at the specified file access level. | EData | int
The data access level (e.g. Data.DATA_LEVEL) of the file. |
string
The base name of the file. |
boolean:optional
Should the data saved to this file be separate for each SMBX save file? |