User:Jeblad/weird lua stuff

From MediaWiki.org
Jump to navigation Jump to search

Something along the lines of

local key, value = do if test then do return foo, bar end else return foo end end

is allowed…

An expression enclosed in parentheses always results in only one value. Thus, (f(x,y,z)) is always a single value, even if f returns several values. (The value of (f(x,y,z)) is the first value returned by f or nil if f does not return any values.)

Testing for unequalness, the usual != is insted done as ~=

Conversion routines are not applied for e1qualness testing so "0"==0 evaluates to false

If both arguments in a comparison is strings, then the result is locale dependent. This will possibly have consequences on servers with multiple sites, ie. multiple wikipedias on a single cluster or wikipedias on incubator.

The operators and and or use short cut evaluation.

Concat av string er med to prikker (..)

Tables can have separators both with comma and semikolon.

Entries for specific indices's are given as [key] = val

{f()} can have multiple elements, {(f())} will have a single element

There is an implicit self when the function is called as foo:bar()