In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how to implement the Lua standard library". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
This library is implemented through the table os
1. Os.clock ()
Function: returns an approximate value of the CPU time used by a program
2. Os.date ([format [, time]])
Function: returns a string or table of dates and times formatted according to format
If the time parameter is set, it is formatted at the time specified by time, otherwise it is formatted at the current time
Parameters:
Format:
"!": formatted in GMT.
"* t": a table with key name will be returned with year (4 bits), month (1-12), day (1mur31), hour (0-23), min (0-59), sec (0-61), wday (day of the week, Sunday is 1), yday (days of the year), and isdst (whether it is daylight saving time true/false); if there is no "* t", a string formatted by C's strftime function will be returned.
If there is no parameter, the formatted string os.date () os.date ("% c") is returned as set by the current system.
3. Os.difftime (T2, T1)
Function: returns the number of seconds between T1 and T2
4. Os.execute ([command])
Function: equivalent to the system function of C #, return the system status code
5. Os.exit ([code])
Function: equivalent to the exit function of C, terminating the main program, and code is the return value
6. Os.getenv (varname)
Function: returns the value of the environment variable varname of the current process, and returns nil if the variable is not defined
7. Os.remove (filename)
Function: delete a file or an empty directory, and add nil plus error message if the function call fails
8. Os.rename (oldname, newname)
Function: change the name of a file or directory, and add nil plus error message if the function call fails
9. Os.setlocale (locale [, category])
Function: sets the current setting of the program. The function returns the value of * *. If it fails, it returns nil.
Parameters:
Locale: a string that specifies the current setting
": an empty string, and the current setting is treated as a local setting
"c": the current setting is treated as a standard c setting
Nil: returns the current value of the category indicating the setting name
Category: a name that describes the setting to be changed
"all" [default], "collate", "ctype", "monetary", "numeric", "time"
10. Os.time ([table])
Function: return a time value (number) according to the content of table, and return the current time without parameters
Fields of table:
Year, month, day, hour, min, sec, isdst
11. Os.tmpname ()
Function: returns a temporary file name
This is the end of the content of "how to implement the Lua Standard Library". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.