Skip to content

GetSample(string)

The GetSample Lua function returns a number representing a percentage usage based on a string input.

  • String:
    Only a specific list of strings can be input:

    • MEMORY
    • CPU
    • CPUTEMP
    • GPUTEMP
    • SYSTEMP
    • FANRPM
  • Number:
    A number (float) is returned.

This example stores the different samples in a table and then prints the content of the table:

Copy CodeLua
```
return function()
-- Gather the sample information in a table
local sample = {}
sample["MEMORY"] = GetSample("MEMORY")
sample["CPU"] = GetSample("CPU")
sample["CPUTEMP"] = GetSample("CPUTEMP")
sample["GPUTEMP"] = GetSample("GPUTEMP")
sample["SYSTEMP"] = GetSample("SYSTEMP")
sample["FANRPM"] = GetSample("FANRPM")
-- Print the collected data
Printf("Memory ; ".. sample["MEMORY"])
Printf("CPU ; ".. sample["CPU"])
Printf("CPU temperature ; ".. sample["CPUTEMP"])
Printf("GPU temperature ; ".. sample["GPUTEMP"])
Printf("System temperature ; ".. sample["SYSTEMP"])
Printf("Fan RPM ; ".. sample["FANRPM"])

end