Résumé

Dialogue avec les développeurs

“ All values carry their own type.
All values in Lua are first-class values. This means that all values can be stored in variables, passed as arguments to other functions, and returned as results.
There are eight basic types in Lua: nil, boolean, number, string, function, userdata, thread, and table. Nil is the type of the value nil, whose main property is to be different from any other value; it usually represents the absence of a useful value. Boolean is the type of the values false and true. Both nil and false make a condition false; any other value makes it true.
”
Source : Wikisource

Dialogue avec les développeurs

“ Acceptable indices serve to avoid extra tests against the stack top when querying the stack. For instance, a C function can query its third argument without the need to first check whether there is a third argument, that is, without the need to check whether 3 is a valid index.
For functions that can be called with acceptable indices, any non-valid index is treated as if it contains a value of a virtual type name="pdf-LUA_TNONE", which behaves like a nil value.
”
Source : Wikisource

Dialogue avec les développeurs

“ Lua code can explicitly generate an error by calling the error function. If you need to catch errors in Lua, you can use pcall or xpcall to call a given function in protected mode.
Whenever there is an error, an error object (also called an error message) is propagated with information about the error. Lua itself only generates errors where the error object is a string, but programs may generate errors with any value for the error object.
”
Source : Wikisource

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