Add convenience functions for /figura run
This commit is contained in:
parent
db47bec57e
commit
408f83242b
14
script.lua
14
script.lua
@ -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
|
||||||
-- }}}
|
-- }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user