augitesoul 0 Posted March 24, 2018 Share Posted March 24, 2018 Hello, I want to obtain the RAM currently used by the computer, by substracting the returned values of computer.totalMemory and computer.freeMemory. Sadly, doing this returns an error message. How should I do this? Quote Link to post Share on other sites
1 Fictitious Rotor 2 Posted March 24, 2018 Share Posted March 24, 2018 1 hour ago, augitesoul said: Hello, I want to obtain the RAM currently used by the computer, by substracting the returned values of computer.totalMemory and computer.freeMemory. Sadly, doing this returns an error message. How should I do this? So a few quick things. First, when you get a problem, please send us a screenshot and logs if possible to make it easier for us to identify your problem. Second, when you're looking at an API in the documentation, be sure to look at the examples that they give as they contain lots of hints! For example, the first snippit.lua in the computer api shows why your program doesn't work. I'll demonstrate a working solution here. Before you can call any methods, you have to assign the computer API to a variable. What they usually do in the documentation is to call the variable 'computer' like so: local computer = require("computer") print(computer.totalMemory()) Because you didn't set the api to a variable first, your program tried to call a variable that doesn't exist and gave up. Should be an easy problem to fix Molinko 1 Quote Link to post Share on other sites
0 augitesoul 0 Posted March 24, 2018 Author Share Posted March 24, 2018 Nevermind - just forgot the () at the end of computer.freeMemory and computer.totalMemory. Sorry for the inconvenience. I'll release my system information program soon, by the way. Quote Link to post Share on other sites
Hello, I want to obtain the RAM currently used by the computer, by substracting the returned values of
computer.totalMemory and computer.freeMemory. Sadly, doing this returns an error message.
How should I do this?
Link to post
Share on other sites