Scaleform Studio Lua API Reference: package namespace reference
Package namespace.
Provides basic facilities for loading modules in Lua. the package library exports one function directly in the global environment: require.
Everything else is exported in a table package.
|
Dynamically links the host program with the C library libname.
|
Parameters libname : | string |
The name of the library to link.
|
funcname : | string |
The name of the function to search for.
|
Returns | This function does not return any values. |
Inside this library, looks for a function funcname and returns this function as a C function.
(So, funcname must follow the protocol (see lua_CFunction)).
Unlike require, this function does not perform any path searching and does not automatically adds extensions. libname must be the complete file name of the C library,
including if necessary a path and extension. funcname must be the exact name exported by the C library (which may depend on the C compiler and linker used).
This function is not supported by ANSI C. As such, it is only available on some platforms (Windows, Linux, Mac OS X, Solaris, BSD, plus other Unix systems that support
the dlfcn standard).
|
Searches for the given name in the given path.
|
Parameters name : | string |
The name of the file to search for.
|
path : | string |
A string containing a sequence of templates separated by semicolons. For each template, the function replaces each interrogation mark (if any) in the template
with a copy of name wherein all occurrences of sep (a dot, by default) were replaced by rep (the system's directory separator, by default), and then
tries to open the resulting file name.
|
sep : | string? |
The separator in the path.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
rep : | string? |
The separator replacing the original one (sep) in the path.
The ? notation indicates that this type is optional: there may be zero or one instances of it. |
Returns string* |
The name of the first file that can be opened, or an error message if the function failed.
The * notation indicates that there may be zero or more instances of the specified type. |
For instance, if the path is the string
"./?.lua;./?.lc;/usr/local/?/init.lua"
the search for the name foo.a will try to open the files ./foo/a.lua, ./foo/a.lc, and /usr/local/foo/a/init.lua, in that order.
Returns the resulting name of the first file that it can open in read mode (after closing the file), or nil plus an error message if none succeeds.
(This error message lists all file names it tried to open.)
|
Sets a metatable for module with its __index field referring to the global environment, so that this module inherits values from the global environment.
|
Parameters module : | string |
The name of the module to search.
|
Returns | This function does not return any values. |
To be used as an option to function module.
package.loadlib (libname, funcname)
Dynamically links the host program with the C library libname.
libname : string
The name of the library to link.
funcname : string
The name of the function to search for.A string of characters.
require (modname) : any
Loads the given module.
package.searchpath (name, path, sep, rep) : string*
Searches for the given name in the given path.
name : string
The name of the file to search for.
path : string
A string containing a sequence of templates separated by semicolons. [more...]
sep : string?
The separator in the path.The ? notation indicates that this type is optional: there may be zero or one instances of it.
rep : string?
The separator replacing the original one (sep) in the path.The ? notation indicates that this type is optional: there may be zero or one instances of it.
string*
The name of the first file that can be opened, or an error message if the function failed.The * notation indicates that there may be zero or more instances of the specified type.
package.seeall (module)
Sets a metatable for module with its __index field referring to the global environment, so that this module inherits values from the global environment.
module : string
The name of the module to search.
modname : string
The name of the module.
any
The value returned by the loader or an error meassage if a loader is not found.This value may be an instance of any type.Indicates a table.
This documentation uses the term table to mean an anonymous, temporary Lua table that contains named data values. You typically use these tables to pass data or settings to a function, or to hold data returned by a function.Indicates an object.
This documentation uses the term object to mean a named Lua table or userdata value that maintains a state. Some object types may have multiple instances existing at the same time, each with its own state; these objects typically have creation functions or accessors that you must call in order to get an instance. Some object types have only one instance, which you always access through the object's name.Indicates a named variable within a namespace, object or table; or an element within an enumeration.Indicates a code sample.Indicates an enumeration.
This documentation uses the term enumeration to mean a named Lua table that contains only a set of constant values. These values typically identify a predefined set of options for some setting or behavior. You might pass an enumeration value to a function, or test the value returned by a function against the items in the enumeration to see which option is currently set.Indicates a named variable within a namespace or object that has a pre-set constant value.Indicates a category: a semantic grouping of related API elements.Indicates a namespace.
This documentation uses the term namespace to mean a named Lua table that exists in only one single instance, intended as a container for an interface of related objects, functions and data variables.Indicates an output value returned by a function.Indicates a named function within a namespace or object.Indicates an input parameter for a function.