This commit is contained in:
Gvidas Juknevičius 2024-08-23 13:09:03 +03:00
parent 9b89185c2a
commit 5fe85f414b
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
3 changed files with 8 additions and 6 deletions

View File

@ -38,16 +38,18 @@ return {
local ____lualib = require("lualib_bundle")
local __TS__Class = ____lualib.__TS__Class
local ____exports = {}
---
-- @noSelf *
____exports.Peripheral = __TS__Class()
local Peripheral = ____exports.Peripheral
Peripheral.name = "Peripheral"
function Peripheral.prototype.____constructor(self)
end
function Peripheral.find(self, ty, filter)
function Peripheral.find(ty, filter)
return peripheral.find(ty, filter)
end
function Peripheral.findOne(self, ty, filter)
local p, _a, _b, _c = table.unpack(____exports.Peripheral:find(ty, filter))
function Peripheral.findOne(ty, filter)
local p, _a, _b, _c = table.unpack(____exports.Peripheral.find(ty, filter))
return p
end
return ____exports
@ -60,7 +62,7 @@ local basalt = ____basalt.default
local ____computercraft = require("src.computercraft")
local Peripheral = ____computercraft.Peripheral
local function main(self)
local d = table.unpack(Peripheral:findOne("monitor"))
local d = Peripheral.findOne("monitor")
local main = basalt.addMonitor()
main:setMonitor(d)
main:addLabel():setText("uwu")

View File

@ -1,4 +1,5 @@
/** @noSelf **/
export class Peripheral {
static find<T extends Peripheral>(ty: string,
filter?: (name: string, wrapped: Peripheral) => boolean

View File

@ -3,8 +3,7 @@ import {Peripheral } from "./computercraft";
function main() {
const [d]: [Monitor] = Peripheral.findOne("monitor");
const d: Monitor = Peripheral.findOne("monitor");
const main = basalt.addMonitor();
main.setMonitor(d);