- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
Search the Community
Showing results for tags 'coroutines'.
-
I'm working on a small bit of code that reads from a IC2 power storage block and displays it's current and maximum storage. I also want it to toggle a Reactor based on either a keypress or a CLI menu option. As the code has to refresh a LOT, I think a keypress option is the easiest way, but I can't, for the life of me, figure it out. Here's what I have so far... os.execute("cls") -- Hook the component local component = require("component") local term = require("term") local side = require("sides") local keyboard = require("keyboard") local event = require("event") local rs = componen
- 13 replies
-
- coroutine
- coroutines
- (and 6 more)
-
This is the program. local component = require("component") local sensor = component.motion_sensor local sides = require("sides") local io = require("io") local term = require("term") local event = require("event") sensor.setSensitivity(0.2) local range=1 ------ Functions ----- function close() local rs1 = component.proxy("bebe4c8f-a23e-4e7a-baec-be0124a0b598") rs1.setOutput(sides.right,0) os.sleep(1) for address in component.list("redstone",true) do local rs = component.proxy(address) rs.setOutput(sides.top,15) end end function open() for address in c
-
Soo I was kinda bored doing basically nothing when I thought about making an OS for OC, which I wanted to do for a long time now. I got pretty far, considering that I'm pretty new to OC, up to the point where it is supposed to start up background "services" at the same time. I didn't know that computer.pullSignal / event.pull doesn't let a coroutine yield (I copied the event and keyboard api over to my OS because I thought I didn't need to rewrite these things on my own) so I quickly had to think of a solution and came up with this. Functions Currently I made it usable for normal Ope
-
Hey, it's me Gangsir. I figured I'd try my hand at writing a tutorial on one of the coolest things (in my opinion) in lua. They say that the best way to learn and understand something is to teach it. This is what I aim to do with this hopefully easily accessible tutorial. What? Let me start off by explaining what a coroutine is, for those that don't know. A coroutine is basically a background function. It allows functions to be run without stopping the main thread. By rapidly stepping through background functions, we can achieve multi-tasking. Think of it like sending out your frien