cc.image.nft
Read and draw nft ("Nitrogen Fingers Text") images.
nft ("Nitrogen Fingers Text") is a file format for drawing basic images.
Unlike the images that paintutils.parseImage uses, nft supports coloured
text as well as simple coloured pixels.
Usage
Load an image from
example.nftand draw it.local nft = require "cc.image.nft" local image = assert(nft.load("data/example.nft")) nft.draw(image, term.getCursorPos())
Changes
- New in version 1.90.0
| parse(image) | Parse an nft image from a string. |
|---|---|
| load(path) | Load an nft image from a file. |
| draw(image, xPos, yPos [, target]) | Draw an nft image to the screen. |
- parse(image)Source
Parse an nft image from a string.
Parameters
- image
stringThe image contents.
Returns
- table The parsed image.
- image
- load(path)Source
Load an nft image from a file.
Parameters
- path
stringThe file to load.
Returns
tableThe parsed image.
Or
- nil If the file does not exist or could not be loaded.
stringAn error message explaining why the file could not be loaded.
- path
- draw(image, xPos, yPos [, target])Source
Draw an nft image to the screen.
Parameters
- image
tableAn image, as returned fromloadorparse. - xPos
numberThe x position to start drawing at. - yPos
numberThe y position to start drawing at. - target?
term.RedirectThe terminal redirect to draw to. Defaults to the current terminal.
- image