Add convenience functions for /figura run

This commit is contained in:
NullBite 2023-06-25 02:00:48 -04:00
parent db47bec57e
commit 408f83242b
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -23,6 +23,9 @@ UVManager=require("nulllib.UVManager")
sharedstate=require("nulllib.sharedstate") sharedstate=require("nulllib.sharedstate")
sharedconfig=require("nulllib.sharedconfig") sharedconfig=require("nulllib.sharedconfig")
-- shortcuts for /figura run so i don't have to type so much
C={}
-- math functions -- math functions
lerp=math.lerp -- this is implemented in figura now lerp=math.lerp -- this is implemented in figura now
wave=nmath.wave wave=nmath.wave
@ -72,7 +75,7 @@ do
sharedconfig.load_defaults(defaults) sharedconfig.load_defaults(defaults)
end end
function printSettings() local function printSettings()
print("Settings:") print("Settings:")
printTable(sharedconfig.load()) printTable(sharedconfig.load())
end end
@ -80,7 +83,16 @@ if sharedconfig.load("print_settings") then
printSettings() printSettings()
end end
--- Convenience, manipulate settings
---@param key? string Key to access
---@param value? any Value to set
function C.set(key, value)
if value ~= nil and key ~= nil then
sharedconfig.save(key, value)
elseif key ~= nil then
print(sharedconfig.load(key))
else else
printSettings()
end end
end end
-- }}} -- }}}