From ComputerCraft Wiki
Revision as of 22:47, 16 February 2015 by Bomb Bloke (Talk | contribs) (Example output.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Grid Redstone.png  Function commands.list
Available only to Command Computers, returns a numerically indexed table filled with strings representing acceptable commands for commands.exec() / commands.execAsync(). This function yields internally and might 'eat' some events, such as rednet_message or key.
Syntax commands.list()
Returns table commands
Part of ComputerCraft
API commands


Grid paper.png  Example
Prints all the available commands.
local commands = commands.list()

textutils.pagedTabulate( commands )
Output Under ComputerCraft 1.7:
gamemode        give            scoreboard
tp              kill            spreadplayers
xp              difficulty      gamerule
clear           time            help
defaultgamemode weather         me
tell            achievement     tellraw
testforblock    seed            playsound
forge           msg             spawnpoint
setblock        w               toggledownfall
effect          say             setworldspawn
summon          testfor         ?
May vary under later versions.

Grid disk.png Commands API Functions
commands.exec - commands.execAsync - commands.list - commands.getBlockPosition - commands.getBlockInfo - commands.getBlockInfos