mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-01 10:07:56 +00:00
Fix usages of global variables
- Lint references to unknown fields of modules, excluding the keys and colours modules. This caught several silly errors in our stub files, but nothing else. - Lint on using unknown globals. This highlighted a couple of really silly mistakes. Fixes #427. - Add documentation for fs.attributes, fs.getCapacity and pocket, as they were not defined before. Co-authored-by: JackMacWindows <jackmacwindowslinux@gmail.com>
This commit is contained in:
@@ -19,6 +19,36 @@ function getFreeSpace(path) end
|
||||
function find(pattern) end
|
||||
function getDir(path) end
|
||||
|
||||
--- Get the capacity of the drive at the given path.
|
||||
--
|
||||
-- This may be used in conjunction with @{getFreeSpace} to determine what
|
||||
-- percentage of this drive has been used.
|
||||
--
|
||||
-- @tparam string path The path of the drive to get.
|
||||
-- @treturn number This drive's capacity. This will be 0 for "read-only" drives,
|
||||
-- such as the ROM or treasure disks.
|
||||
function getCapacity(path) end
|
||||
|
||||
--- Get attributes about a specific file or folder.
|
||||
--
|
||||
-- The returned attributes table contains information about the size of the
|
||||
-- file, whether it is a directory, and when it was created and last modified.
|
||||
--
|
||||
-- The creation and modification times are given as the number of milliseconds
|
||||
-- since the UNIX epoch. This may be given to @{os.date} in order to convert it
|
||||
-- to more usable form.
|
||||
--
|
||||
-- @tparam string path The path to get attributes for.
|
||||
-- @treturn { size = number, isDir = boolean, created = number, modified = number }
|
||||
-- The resulting attributes.
|
||||
-- @throws If the path does not exist.
|
||||
-- @see getSize If you only care about the file's size.
|
||||
-- @see isDir If you only care whether a path is a directory or not.
|
||||
function attributes(path) end
|
||||
|
||||
-- Defined in bios.lua
|
||||
function complete(sPath, sLocation, bIncludeFiles, bIncludeDirs) end
|
||||
|
||||
--- A file handle which can be read from.
|
||||
--
|
||||
-- @type ReadHandle
|
||||
|
@@ -15,3 +15,10 @@ function cancelTimer(id) end
|
||||
function cancelAlarm(id) end
|
||||
function epoch(timezone) end
|
||||
function date(format, time) end
|
||||
|
||||
-- Defined in bios.lua
|
||||
function loadAPI(path) end
|
||||
function pullEvent(filter) end
|
||||
function pullEventRaw(filter) end
|
||||
function version() end
|
||||
function run(env, path, ...) end
|
||||
|
28
doc/stub/pocket.lua
Normal file
28
doc/stub/pocket.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
--[[-
|
||||
Control the current pocket computer, adding or removing upgrades.
|
||||
|
||||
This API is only available on pocket computers. As such, you may use its
|
||||
presence to determine what kind of computer you are using:
|
||||
|
||||
```lua
|
||||
if pocket then
|
||||
print("On a pocket computer")
|
||||
else
|
||||
print("On something else")
|
||||
end
|
||||
```
|
||||
]]
|
||||
|
||||
--- Search the player's inventory for another upgrade, replacing the existing
|
||||
-- one with that item if found.
|
||||
--
|
||||
-- This inventory search starts from the player's currently selected slot,
|
||||
-- allowing you to prioritise upgrades.
|
||||
--
|
||||
-- @throws If an upgrade cannot be found.
|
||||
function equipBack() end
|
||||
|
||||
--- Remove the pocket computer's current upgrade.
|
||||
--
|
||||
-- @throws If this pocket computer does not currently have an upgrade.
|
||||
function unequipBack() end
|
@@ -11,4 +11,4 @@ setAnalogueOutput = setAnalogOutput
|
||||
function getAnalogOutput(sid) end
|
||||
getAnalogueOutput = getAnalogOutput
|
||||
function getAnalogInput(side) end
|
||||
getAnalogueInput = getAnaloguInput
|
||||
getAnalogueInput = getAnalogInput
|
||||
|
@@ -15,14 +15,14 @@ isColor = isColour
|
||||
function getTextColour() end
|
||||
getTextColor = getTextColor
|
||||
function getBackgroundColour() end
|
||||
getBackgroundColour = getBackgroundColour
|
||||
getBackgroundColor = getBackgroundColour
|
||||
function blit(text, text_colours, background_colours) end
|
||||
function setPaletteColour(colour, ...) end
|
||||
setPaletteColour = setPaletteColour
|
||||
setPaletteColor = setPaletteColour
|
||||
function getPaletteColour(colour, ...) end
|
||||
getPaletteColour = getPaletteColour
|
||||
getPaletteColor = getPaletteColour
|
||||
function nativePaletteColour(colour) end
|
||||
nativePaletteColour = nativePaletteColour
|
||||
nativePaletteColor = nativePaletteColour
|
||||
|
||||
--- @type Redirect
|
||||
local Redirect = {}
|
||||
|
Reference in New Issue
Block a user