Contact Us

CATEGORIES

Whoops…Nothing found

Try other keywords in your search

LUA OS Library In PIXERA

 1 Minute

 0 Likes

 115 Views

In PIXERA Modules, you can use the OS Library to control the system's files and get information on the system.


Calls

 

  • clock()
    • Returns an approximation of the amount in seconds of CPU time since the program has started. Useful for getting a new value every call of the Action such as for random numbers.
  • date(%a)
    • Returns a string or a table containing date and time information, formatted depending on the given string format. Refer to this link for more information on how to use this function: https://www.lua.org/pil/22.1.html
  • difftime(number x, number y)
    • Returns the difference, in seconds, from time x to time y (These times are values returned by os.time()).
  • execute(string command)
    • Passes the command to the operating system shell to be called. Will return multiple results, first true if the command terminated successfully, or nil otherwise. The second result will be a string plus a number:
      • “exit”: Command was terminated with a following exit status number
      • “signal”: Command was terminated by a signal with a following number that is the signal which caused the termination.
    • When called without a command, the call returns a boolean that is true if a shell is available.
  • exit()
    • Calls the function to terminate the host program, in this case PIXERA. This is not recommended as PIXERA will freeze with this call.
  • getenv(string process)
    • Returns the value of the given process environment variable varname, or nil if the variable is not defined.
  • remove(filepath)
    • Deletes the file at the given path and with the given name. If the function fails it returns nil, plus a string describing the error and the error code, otherwise it returns true.
  • rename(string oldName, string newName)
    • Renames the file or directory to the new given name. If the function fails it returns nil, plus a string describing the error and the error code, otherwise it returns true.
  • time(args)
    • Returns a string containing date and time information, formatted depending on the given table format. Refer to this link for more information on how to use this function: https://www.lua.org/pil/22.1.html
  • tmpname()
    • Returns a string with a file name that can be used as a temporary file. The file must be explicitly opened before its use and explicitly removed when no longer needed.

 

Pixera 2.0.172 | 18. November 2024 | C.L.

 

 

Was this article helpful?