augitesoul 0 Posted March 30, 2018 Share Posted March 30, 2018 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. Quote Link to post Share on other sites
CptMercury 6 Posted March 31, 2018 Share Posted March 31, 2018 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"? augitesoul 1 Quote Link to post Share on other sites
Molinko 43 Posted March 31, 2018 Share Posted March 31, 2018 Good suggestion Cpt. I'd also like to suggest table.concat as well. Quote Link to post Share on other sites
augitesoul 0 Posted March 31, 2018 Author Share Posted March 31, 2018 Hello, thanks for your input. I updated the script, and I am making the light version (will run on almost any computer) right now! Update: The lighter version is obtainable from here: https://github.com/AugiteSoul/AugiteOpenComputers/blob/master/systeminfo-light/systeminfo.lua Quote Link to post Share on other sites