mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-06-30 17:13:20 +00:00
![Wojbie](/assets/img/avatar_default.png)
In no particular order: bios.lua - added missing test for ensure turtle folder exists. paintutils.lua - added drawLineHorizontal() to reduce most (not all) cases of running multiple writes on same horizontal line that can be solved with one write. textutils.lua - Added exception to complete function - will not complete if provided with LuaKeyword - solves do->dofile problem and removes other LuaKeyword related ones in advance. edit.lua - Changed logic in handling the paste event - if paste event is received when menu is open it automatically closed said menu and lets it paste - resolves ctrl+ctrl+v annoyance. Added Jump to Menu functions - allows for fast jump to needed line - must for bigger files and a nice feature to have. set.lua - Switched set to use pagedPrint - this will ensure that even if there are more settings than lines on screen the set command will show you all of them. startup.lua - Added autocompletition for turtle programs go, turn, equip, unequip and command program exec. lua.lua - Changed return function to print returned stuff correctly - will print all returned variables even if there are any nils in there.
46 lines
1.2 KiB
Lua
46 lines
1.2 KiB
Lua
|
|
local tArgs = { ... }
|
|
if #tArgs == 0 then
|
|
-- "set"
|
|
local x,y = term.getCursorPos()
|
|
local tSettings = {}
|
|
for n,sName in ipairs( settings.getNames() ) do
|
|
tSettings[n] = textutils.serialize(sName) .. " is " .. textutils.serialize(settings.get(sName))
|
|
end
|
|
textutils.pagedPrint(table.concat(tSettings,"\n"),y-3)
|
|
|
|
elseif #tArgs == 1 then
|
|
-- "set foo"
|
|
local sName = tArgs[1]
|
|
print( textutils.serialize(sName) .. " is " .. textutils.serialize(settings.get(sName)) )
|
|
|
|
else
|
|
-- "set foo bar"
|
|
local sName = tArgs[1]
|
|
local sValue = tArgs[2]
|
|
local value
|
|
if sValue == "true" then
|
|
value = true
|
|
elseif sValue == "false" then
|
|
value = false
|
|
elseif sValue == "nil" then
|
|
value = nil
|
|
elseif tonumber(sValue) then
|
|
value = tonumber(sValue)
|
|
else
|
|
value = sValue
|
|
end
|
|
|
|
local oldValue = settings.get( sValue )
|
|
if value ~= nil then
|
|
settings.set( sName, value )
|
|
print( textutils.serialize(sName) .. " set to " .. textutils.serialize(value) )
|
|
else
|
|
settings.unset( sName )
|
|
print( textutils.serialize(sName) .. " unset" )
|
|
end
|
|
if value ~= oldValue then
|
|
settings.save( ".settings" )
|
|
end
|
|
end
|