Lua

Définition et enjeux

Dialogue avec les développeurs

“ To represent records, Lua uses the field name as an index. The language supports this representation by providing a.name as syntactic sugar for a ["name"] . There are several convenient ways to create tables in Lua (see §3.4.8) .
We use the term sequence to denote a table where the set of all positive numeric keys is equal to {1..n} for some integer n, which is called the length of the sequence (see §3.4.6) .
Like indices, the values of table fields can be of any type. In particular, because functions are first-class values, table fields can contain functions.
”
Source : Wikisource

Dialogue avec les développeurs

“ It is easy to set up a module with regular Lua code. Modules are not expected to set global variables. Functions setfenv and getfenv were removed, because of the changes in environments. Function math.log10 is deprecated. Use math.log with 10 as its second argument, instead. Function loadstring is deprecated. Use load instead; it now accepts string arguments and are exactly equivalent to loadstring. Function table.maxn is deprecated. Write it in Lua if you really need it. Function os.execute now returns true when command terminates successfully and nil plus error information otherwise. ”
Source : Wikisource

Dialogue avec les développeurs

“ The package library provides basic facilities for loading modules in Lua. It exports one function directly in the global environment: require. Everything else is exported in a table name="pdf-package".
name="pdf-require" Loads the given module. The function starts by looking into the package.loaded table to determine whether modname is already loaded. If it is, then require returns the value stored at package.loaded [modname] . Otherwise, it tries to find a loader for the module.
”
Source : Wikisource

Chaque jour avec Kwize, l'actualité mise en perspective par la littérature