This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
tutorial:custom_oses [2015/01/14 23:41] 127.0.0.1 external edit |
tutorial:custom_oses [2015/10/14 04:09] ultrahex [What's Available?] |
||
---|---|---|---|
Line 61: | Line 61: | ||
coroutine.yield | coroutine.yield | ||
+ | debug.getinfo | ||
debug.traceback | debug.traceback | ||
Line 123: | Line 124: | ||
component.doc | component.doc | ||
+ | component.fields | ||
component.invoke | component.invoke | ||
component.list | component.list | ||
component.methods | component.methods | ||
component.proxy | component.proxy | ||
+ | component.slot | ||
component.type | component.type | ||
Line 134: | Line 137: | ||
computer.energy | computer.energy | ||
computer.freeMemory | computer.freeMemory | ||
+ | computer.getArchitectures | ||
+ | computer.getArchitecture | ||
computer.getBootAddress | computer.getBootAddress | ||
computer.maxEnergy | computer.maxEnergy | ||
Line 139: | Line 144: | ||
computer.pushSignal | computer.pushSignal | ||
computer.removeUser | computer.removeUser | ||
+ | computer.setArchitecture | ||
computer.setBootAddress | computer.setBootAddress | ||
computer.shutdown | computer.shutdown | ||
Line 157: | Line 163: | ||
unicode.wtrunc | unicode.wtrunc | ||
``` | ``` | ||
+ | |||
+ | Accessing components in BIOS | ||
+ | ----------------- | ||
+ | Unlike in OpenOS you don't have the primary system for components in BIOS. That means you cannot just write `component.redstone.setOutput`, you have to manually create your proxy for the component first. For several reasons the proxy system is provided via the machine itself, so you can still use that. To get a proxy, use the `component.proxy` method. It expects the address of the component to wrap. You can either write that down manually, or get the list of components using `component.list` and go from there. | ||
+ | |||
+ | For example, to get the first best redstone component, you can do the following: | ||
+ | ```lua | ||
+ | local r = component.proxy(component.list("redstone")()) | ||
+ | ``` | ||
+ | This works because `component.list` returns a Lua iterator: a function that can be called repeatedly to get the next element in whatever it iterates over, returning `nil` once there are no more elements. | ||
A few more things | A few more things |