Advertisement
ct201158

Scripties Findies

Sep 20th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.31 KB | None | 0 0
  1. Scripties Findies:
  2. -----------------------------------------------------------
  3. assert = Variant assert(Variant value, string errorMessage = "assertion failed!")
  4.  
  5. Description: Throws an error if the provided value is false or nil . Returns the value that was passed into the function if the assertion passes.
  6.  
  7. collectgarbage = Variant collectgarbage(string operation)
  8.  
  9. Description: Performs an operation on the Lua garbage collector based on the specified option. Roblox's Lua sandbox only allows the "count" option to be used, so none of the other standard options are available. The "count" option returns the total memory in use by Lua (in kilobytes).
  10.  
  11. error = void error(string message = "Error occurred, no output from Lua.", int level = 1)
  12.  
  13. Description: Terminates the last protected function called and outputs message as an error message. If the function containing the error is not called in a protected function (pcall), then the script which called the function will terminate. The error function itself never returns and acts like a script error. The level argument specifies how to get the error position. With level 1 (the default), the error position is where the error function was called. Level 2 points the error to where the function that called error was called; and so on. Passing a level 0 avoids the addition of error position information to the message.
  14.  
  15. getfenv = array getfenv(int stack = 1)
  16.  
  17. Description: Returns the current environment in use by the function. If provided with a function, the environment of the function will be returned as an array. If provided with an integer, getfenv will provide the environment of the function at the provided stack level: Level 1 is the function calling getfenv. If stack is 0, getfenv returns the global environment of the current script. When using getfenv to get the current environment of a script, it will return the same table every time within the specific thread.
  18.  
  19. getmetatable = Variant getmetatable(Variant object)
  20.  
  21. Description: Returns the metatable of the specified object if it has one, otherwise returns nil. If the object does have a metatable, but the metatable has a __metatable field set, the value of __metatable will be returned instead.
  22.  
  23. ipairs = function, table, int ipairs(table t)
  24.  
  25. Description: Returns three values: an iterator function, and the table t.
  26.  
  27. loadfile = function loadfile(string path)
  28.  
  29. Description: Loads a Lua file from the specified path and returns it as a function. This is used internally by Roblox and doesn't really have a practical use for developers.
  30.  
  31. loadstring = Variant loadstring(string contents)
  32.  
  33. Description: Loads Lua code from a string, and returns it as a function. Unlike standard Lua 5.1, Roblox's Lua cannot load the binary version of Lua using loadstring.
  34.  
  35. newproxy = userdata newproxy(bool addMetatable)
  36.  
  37. Description: Creates a blank 'userdata'. If addMetatable was specified, includes an empty metatable.
  38.  
  39. next = Variant, Variant next(table t, Variant lastKey = nil)
  40.  
  41. Description: Returns the first key/value pair in the array. If a lastKey argument was specified then returns the next element in the array based on the key that provided. The order in which the indices are enumerated is not specified, even for numeric indices. To traverse a table in numeric order, use a numerical for or the ipairs function. The behavior of next is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may, however, modify existing fields. In particular, you may clear existing fields.
  42.  
  43. pairs = function, table pairs(table t)
  44.  
  45. Description: Returns the next function, and the passed table t, so that the construction will iterate over all key/value pairs of that table. See the function next for the caveats of modifying the table during its traversal.
  46.  
  47. pcall = bool, Variant pcall(function func, Tuple args)
  48.  
  49. Description: Calls the function func with the given arguments in protected mode. This means that any error inside func is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message.
  50.  
  51. print = void print(Tuple params)
  52.  
  53. Description: Receives any number of arguments, and prints their values to the output, using the tostring function to convert them to strings. print is not intended for formatted output, but only as a quick way to show a value, typically for debugging. For a formatted output, use string.format.
  54.  
  55. rawequal = bool rawequal(Variant v1, Variant v2)
  56.  
  57. Description: Checks whether v1 is equal to v2, without invoking any metamethod.
  58.  
  59. rawget = Variant rawget(table t, Variant index)
  60.  
  61. Description: Gets the real value of table[index], without invoking any metamethod.
  62.  
  63. rawset = table rawset(table t, Variant index, Variant value)
  64.  
  65. Description: Sets the real value of table[index] to a given value, without invoking any metamethod.
  66.  
  67. select = Tuple select(int index, Tuple args)
  68.  
  69. Description: Returns all arguments after argument number index.
  70.  
  71. select = int select(string cmd, Tuple args)
  72.  
  73. Description: Returns the total number of arguments that were passed after the cmd argument.
  74.  
  75. setfenv = Variant setfenv(Variant f, table fenv)
  76.  
  77. Description: Sets the environment to be used by the given function. f can be a function or a number that specifies the function at that stack level: Level 1 is the function calling setfenv. setfenv returns the given function. As a special case, when f is 0 setfenv changes the environment of the running thread. In this case, setfenv returns no values.
  78.  
  79. setmetatable = table setmetatable(table t, Variant setTo)
  80.  
  81. Description: Sets the metatable for the given table. If setTo is nil, the metatable of the given table is removed. If the original metatable has a "__metatable" field, this will raise an error. This function returns the table t, which was passed to the function.
  82.  
  83. tonumber = Variant tonumber(Variant arg, int base = 10)
  84.  
  85. Description: Attempts to convert the arg into a number with a specified base to interpret the value in. If it cannot be converted, this function returns nil. The base may be any integer between 2 and 36, inclusive. In bases above 10, the letter 'A' (in either upper or lower case) represents 10, 'B' represents 11, and so forth, with 'Z' representing 35. In base 10 (the default), the number may have a decimal part, as well as an optional exponent part. In other bases, only unsigned integers are accepted.
  86.  
  87. tostring = string tostring(Variant e)
  88.  
  89. Description: Receives an argument of any type and converts it to a string in a reasonable format. If the metatable of e has a "__tostring" field, then tostring calls the corresponding value with e as an argument and uses the result of the call as its result. For complete control of how numbers are converted, use string.format.
  90.  
  91. type = string type(Variant v)
  92.  
  93. Description: Returns the type of its only argument, coded as a string. The possible results of this function are "nil" (a string, not the value nil), "number", "string", "boolean", "table", "function", "thread", and "userdata".
  94.  
  95. unpack = Variant unpack(table list, int i = 1, int j = #list)
  96.  
  97. Description: Returns the elements from the given table. By default, i is 1 and j is the length of list, as defined by the length operator.
  98.  
  99. xpcall = bool, Variant xpcall(function f, function err)
  100.  
  101. Description: This function is similar to pcall , except that you can set a new error handler. xpcall calls function f in protected mode, using err as the error handler. Any error inside f is not propagated; instead, xpcall catches the error, calls the err function with the original error object, and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In this case, xpcall also returns all results from the call, after this first result. In case of any error, xpcall returns false plus the result from err.
  102.  
  103. VARIABLES
  104.  
  105. -----------------------------------------------------------
  106.  
  107. _G = array _G
  108.  
  109. Description: A table that is shared between all scripts of the same context level.
  110.  
  111. _VERSION = string _VERSION
  112.  
  113. Description: A global variable (not a function) that holds a string containing the current interpreter version.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement