--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]] local ____exports = {} local buffer = require("buffer") local storageState local filename = "" local isSetup = false local function setup() filename = SIMPLE_STORAGE_FILE or "simpleStorage.store" local isFile = love.filesystem.getInfo(filename) if isFile then local file = love.filesystem.read("string", filename) if type(file) == "string" then storageState = buffer.decode(file) end else storageState = {} end isSetup = true end ____exports.getField = function(fieldName, defaultValue) if not isSetup then setup() end return storageState[fieldName] or defaultValue end ____exports.setField = function(fieldName, val) if not isSetup then setup() end storageState[fieldName] = val local b = buffer.encode(storageState) love.filesystem.write(filename, b) end ____exports.newField = function(fieldName, defaultValue) return { getField = function() return ____exports.getField(fieldName, defaultValue) end, setField = function(val) return ____exports.setField(fieldName, val) end } end return ____exports