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

systeminfo - well... showing system information...?

Recommended Posts

My first big program. It shows:

-a randomized message (requested from my HTTP server, and fortune on the server side),

-Computer address, used/free/all RAM, energy levels, uptime, filesystem for booting, whether the computer can do HTTP requests,

-List of components available

Thanks to CptMercury and payonel for some parts of the code. I will make it available through OPPM soon, but for now you will need to get it through GitHub:

https://github.com/AugiteSoul/AugiteOpenComputers/blob/master/systeminfo/systeminfo.lua

Feel free to send some feedback, positive or not! I will try to answer everyone.

Link to post
Share on other sites

Looking good, neat program!

Some advice for dealing with strings:

If you want to print some text on your screen and insert some numbers/other variables/returns of functions etc. into that text, instead of writing one part of the text, writing the number, and write the second part of the text you can just concatenate(connect) the different strings and the numbers using the concat operator ..  (2 dots), then print it. In other words, combine all the different parts of the text first, and then write it to the screen. This will reduce the number of lines in your code and less screen operations are performed.

io.write("string1")
io.write("string2")
-- # -> string1string2

-- # you get the same result with

io.write("string1".."string2")
-- # -> string1string2

-- # you can include numbers with

io.write("string"..1.."string"..2)
-- # -> string1string2

-- # you dont have to use the strings/numbers directly, variables containing strings and numbers work fine as well

local s = "string"
local num1 = 1
local num2 = 2

io.write(s..num1..s..num2)
-- # -> string1string2

-- # one example of your code would be: line 55 - 59
term.write("Energy available/maximum: "..computer.energy().."/"..computer.maxEnergy().."\n")

And one question: do you actually want the program to wait before printing a new set of information on the screen or do you just want to let your program yield in order to avoid "too long without yielding errors"?

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
Reply to this topic...

×   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.