Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
BloxBall

Not enough info in API.

Question

So recently I have been playing Minecraft with the OC mod, and this just couldn't let me progress: the API doesn't tell you which functions components have.

To be exact, when I type this script:

component=require("component)

printer=component.printer3d

I don't know which functions the component "3D Printer" has. For example, I want to print something but don't know the functions for it. I've tried typing "printer" in the terminal, but the output Is too large, and the first few lines sink in the flood of new lines!

Please, tell me if there's a fix!

Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 3
  • Solution

firstly, always declare your identifiers as local unless you intend to create global variables for use and effect in other scripts.

local component = require("component")
local printer = component.printer3d

secondly, you could iterate the component proxy, it is a table

for k, v in pairs(printer) do
	print(k, type(v))
end

or you can use the command line tool, components

/home # components

and you can list functions and doc details of component using the -l option, and you can filter the components listed specifying a name

/home # components -l printer3d

 

Link to post
Share on other sites
  • 0

Also, all the base components should have a page on the official wiki. I take it you've been exploring the API section, but you might have overlooked the Components one. In particular, this page on 3D Printer has a list of all its functions, as well as their short descriptions - check it out!

As for the components not present on the wiki (added by various addons) or just for the in-game quick reference, you could easily use @payonel's method, too. ^_^

Did it help?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.