• CCEmuX
  • Docs
  • GitHub

Peripherals

Along with emulating ComputerCraft's core, CCEmuX also emulates a couple of CC's peripherals. This allows you to test and develop a whole slew of other programs within the emulator.

Peripherals are attached using the ccemux.attach method. This takes a peripheral side (such as `left` or `top`), the name of a peripheral (we'll get onto that in a moment) and an optional table, specifying any additional options.

# Wireless modems

As mentioned above, ccemux.attach takes a "peripheral name". This allows us to determine what kind of peripheral you want to attach. A wireless modem's peripheral name is (unsurprisingly) "wireless_modem".

If you run ccemux.attach("left", "wireless_modem") in the Lua shell, you should now have access to a wireless modem. You could even add this to your startup file to make sure it's always there.

While this is all well and good, sometimes you may need to tweak the modem a little. Perhaps you need several at different positions? Or maybe you want to restrict the range? This is where the options table comes in:

ccemux.attach("left", "wireless_modem", {
  -- The range of this modem
  range = 64,

  -- Whether this is an ender modem
  interdimensional = false,

  -- The current world's name. Sending messages between worlds requires an interdimensional modem
  world = "main",

  -- The position of this wireless modem within the world
  posX = 0, posY = 0, posZ = 0,
})

# Disk drives

Disk drives can be attached using the "disk_drive" peripheral name. By default, they don't have a disk inside them: you need to pass in a disk ID:

ccemux.attach("left", "disk_drive", {
  -- The disk's ID
  id = 0
})

The /disk folder should now be mounted, and you will be able to write to it.

Contents

  • Wireless modems
  • Disk drives

Documentation

  • Getting Started
  • Peripherals
  • The ccemux API
  • Tips and tricks
  • Command line arguments