Skip to main content

Storage:read()

Read a stored value by key.

Parameters

ParametersTypeDescription
keystringThe storage key

Signature

Storage:read(key: string): string | nil

Returns

string | nil - The stored value as a string, or nil when the key is not found

Description

Storage:read() returns the stored value as text. Numeric and boolean values are also returned as strings.

Examples

local username = Storage:read("username")
if username ~= nil then
print(username)
end
local retryCount = Storage:read("retry_count")
if retryCount ~= nil then
local count = tonumber(retryCount)
print(count)
end

Notes

  • Missing keys return nil
  • Stored numbers and booleans are returned as strings
  • The key must not be empty