The LUA function is recorded

Source: Internet
Author: User
Tags bitwise natural logarithm strfind blizzard

These standard LUA functions are available in most LUA parsing. It is indisputable that we can look at the LUA Web site, but some of the fewer functions have been blizzard. All LUA functions are listed below. The LUA note in WoW API does not provide all the standard LUA functions in Wowapi, and it is clear that the operating system and file I/o Library is a LUA function that is not supported these functions are part of the LUA programming language, click here to learn more.? assert (value)-Check if a value is non-nil, if not (if you open the Debug command in Wow.exe), display the dialog box and output error debugging information? CollectGarbage ()-Garbage collector. (added in 1.)10.1)? date (format, time)-returns the time on the current user's machine. Error ("error Message", level)-When an error occurs, output a defined error message. Use Pcall () (see below) to catch an error. Gcinfo ()-returns the amount of memory used in the plug-in (KB) and the current garbage collector usage (KB). getfenv (function or integer)-returns the stack structure or stack level of the function that this table has obtained? getmetatable (obj, mtable)-gets the current meta-table or user data object. loadstring ("Lua Code") -Parse a LUA code block in a string and return the result as a function? Next (table, index)-returns the next key, a pair of table values. Allow traversal of the entire table? Pcall (func, arg1, arg2, ...)-protected invocation. Executes the function contents while capturing all exceptions and errors.Select(Index, list)-Returns the value of the item selected in this list. Or is this item indexed in the list? setfenv (function or integer, table)-Set this table to get the stack structure or stack level of the function? setmetatable (obj, mtable)-set the current table's meta-table or user data object? time (table)-return from a Unix time value? type (var)-Determine the type of the current variable," Number","string","Table","function"Or"UserData".? unpack (table)-unzip a table. Returns all values in the current table. Xpcall (func, err)-returns a Boolean value indicating the function that was executed successfully and the error message that the call failed. In addition, the function or the incorrect return value of the Math function these table functions can also refer to the LUA library (they all start with math. See Math Library for more information). Trigonometric functions are of no reference, Include Angle-conversion of radians. The blizzard version uses the angle. and the standard math library of LUA uses radians.? ABS (Value)-returns the absolute value of the current value? ACOs (value)-returns the Arc cosine value of this angle value. ASIN (value)-returns the arc sine value of this angle value? Atan (value)-returns the arc tangent value of this angle value? atan2 (y, x)-In the angle, return y/the arc tangent of X. Ceil (value)-returns an integer, regardless of the number after the decimal point, in the integer part 1? cos (degrees)-returns the cosine of an angle? deg (radians)-radian Conversion angle? exp (value)-returns the exponential value of this value? Floor (value)-returns the integer value of this value? frexp (num)-returns the numeric value of the current digit after the decimal point and the number of digits after the decimal point? ldexp (value, multiple)-output A multiple of this value? Log (value)-returns the natural logarithm (base e) of this value? log10 (value)-return a value of base 10? Max (value[, Values ...])-find the maximum value in a pile of values? min (Value[,values ...])-find the minimum value in a bunch of values? MoD (Value,modulus)-returns the remainder of this value? RAD (degrees)-angle Conversion radian? random ([[[Lower,] upper])-returns a random number (an optional limit is an integer value)? Randomseed (Seed)-Seeding a pseudo-random number generator? Sin (degrees)-returns the sine of the current angle? sqrt (value)-returns the square root of a numeric value (for example, 100 squared root)? Tan (degrees)-returns the tangent string library for the current angle these table functions can also refer to the LUA string library (they all start with a string, refer to the strings library for more information)? format (formatstring[, value[, ...])-format string? gsub (string, pattern,replacement[, Limitcount])-Global replacement? Strbyte (string[, index]) -The conversion string is an integer value (you can specify a character). Strchar (asciicode[, ...])-convert an integer to a corresponding character? Strfind (string, pattern[, initpos[, plain])-searches for the specified content in a specified target string (the third parameter is an index), returning its exact location. strlen (string) -returns the number of characters in the current string? Strlower (string) -convert the letter of a string to lowercase format? strmatch (string, pattern[, Initpos])-Unlike Strfind, MACTH returns a specific value, and find returns the position of this value? Strrep (Seed,count)-returns the number of seed copies of a string? Strsub (string, index[, EndIndex])-returns the value of the specified position of the string. Strupper (string) -Convert the letter of a string to uppercase? Tonumber (arg[,Base]) -returns a numeric value if the parameter can be converted to a number. You can specify the type of conversion. Default is a decimal integer? ToString (Arg)-A string function that converts a parameter to a string is unique to Wow? Strtrim (string) -remove space before and after a string? Strsplit (delimiter,string) -split string? Strjoin (delimiter,string,string[, ...]) -concatenate strings by delimiter table functions These table functions can also refer to the LUA table library (they are all"table. Start", consult table Library F for more information). Also know that many tables are designed to have only numeric indexes, starting at 1 and without endings (like {[1] ="Foo", [3] ="Bar"} --- [2is not present, so it is nil value). While working, there is no difference from any other table, but it is likely to produce unexpected results. In writing Lua, this is the usual bug?foreach(table,function)-perform a function for each element in a table? Foreachi (table,function)-executes functions for each element in the table, accessed sequentially (not recommended, can be replaced with ipairs)? GETN (table)-returns the size of the current table when it is a chat table. Now obsolete, you can use the # symbol directly. Use # (table) instead of TABLE.GETN (table)? Ipairs (Table )-returns an iterative integer traversal table. Pairs (table)-returns an iteration traversal table? Sort (table[, comp])-To sort an array, you can also specify an optional order function? Tinsert (table[, POS], value)-inserts an element into the specified position (default at the end of the table)? Tremove (table[, POS])-deletes the element at the specified location (the default table is the last) Bit functions World of Warcraft contains the Lua Bitlib library (they are all"bit."Start). Is the same as the bitwise operation of C. Bit operations Library is not part of the LUA standard library, but in Wow1. 9 has been applied? Bit.bnot (a)-return a supplement? Bit.band (W1,...)-returns the bit of W with the Bit.bor (W1,...)-returns the bit of W or? Bit.bxor (W1,...)-returns the bitwise XOR of W Bit.lshift (A, b)-return A to the left offset to the B-bit? Bit.rshift (A, A, a)-returns a logical right offset to B-bit? Bit.arshift (A, A, a)-return a arithmetic offset to B-bit? Bit.mod (A, A, a)-returns the integer remainder of a divided by B Lua is a scripting language that uses these functions to compare your data structures very slowly. Unless you have a very large database and need to protect the RAM used, save your information to several or individual variables. Notes? All characters have their meta-table set to the Global string table, so some string functions can be written directly before the colon for invocation: Toggle line number Display1Local S =string. Format (input, arg1, arg2, ...) 2    3--can be written like this4Local s = Input:format (Arg1, arg2, ...) --input is copied to the code as the first parameter, which is the colon syntax? This can also be used on strings,"%d": Format (arg1) is not a valid LUA code, you can write a toggle line number display1("%d"): Format (arg1)? Since the use of string tables, some functions in the string table can also work, the following example is valid: Toggle line number Display1functionstring. Print (a)2  returnprint (a)3End4("Test"):p rint () Although you should try to avoid populating the string table with your function. Related Resources You can also refer to LUA for more information about LUA development.

The LUA function is recorded

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.