Difference between revisions of "Template:Lua programming language"

From blackwiki
Jump to navigation Jump to search
imported>User 53
m
 
(13 intermediate revisions by 11 users not shown)
Line 1: Line 1:
print("Hello World!")
+
{{Navbox
function factorial(n)
+
|name = Lua programming language
  if n == 0 then
+
|state = {{{state|{{{1|}}}}}}
    return 1
+
|title = [[Lua (programming language)|Lua programming language]]
  else
+
|listclass = hlist
    return n * factorial(n - 1)
+
 
  end
+
|group1 = Interpreters and compilers <!--(implementations, not ports)-->
end
+
|list1 =
function factorial2(n)
+
*[[Lua (programming language)|Lua]] (reference implementation from [[PUC-Rio]])
  return n == 0 and 1 or n * factorial2(n - 1)
+
*[[LuaJIT]]
end
+
*[[Parrot virtual machine|Parrot]]
do
+
 
  local oldprint = print  -- Store current print function as oldprint
+
|group2 = Package manager
  function print(s)        -- Redefine print function
+
|list2 =
    if s == "foo" then
+
*[[LuaRocks]]
      oldprint("bar")
+
 
    else
+
|group3 = Ports and distributions
      oldprint(s)
+
|list3 =
    end
+
*[[Plua]]
  end
+
*Lua Player
end
+
*[[Löve (game engine)|LÖVE]]
function addto(x)
+
*[[Solar2D]]
  -- Return a new function that adds x to the argument
+
 
  return function(y)
+
|group4 = [[Integrated development environment|IDE]]s
    -- When we refer to the variable x, which is outside of the current
+
|list4 =
    -- scope and whose lifetime is longer than that of this anonymous
+
*[[Unknown Worlds Entertainment|Decoda]]
    -- function, Lua creates a closure.
+
*[[SciTE]]
    return x + y
+
*[[Comparison of integrated development environments#Lua|Comparison of Lua IDEs]]
  end
+
 
end
+
|group5 = Applications and frameworks
fourplus = addto(4)
+
|list5 =
print(fourplus(3))  -- Prints 7
+
*[[Prosody (software)|Prosody]]
fibs = { 1, 1 }                          -- Initial values for fibs[1] and fibs[2].
+
*[[Torch (machine learning)|Torch]]
setmetatable(fibs, {                    -- Give fibs some magic behavior.
+
*[[Tarantool]]
  __index = function(name, n)            -- Call this function if fibs[n] does not exist.
+
*[[IUP (software)|IUP]]
    name[n] = name[n - 1] + name[n - 2] -- Calculate and memorize fibs[n].
+
*[[List of applications using Lua]]
    return name[n]
+
 
  end
+
|below = [[Wikipedia:Lua|Lua in Wikipedia]]
})
+
}}<noinclude>{{Documentation |content=
 +
{{Collapsible option |statename=optional}}
 +
 
 +
[[Category:Programming language templates|Lua]]
 +
[[Category:Lua (programming language)|τ]]
 +
}}</noinclude>

Latest revision as of 10:50, 15 January 2021

Template documentation

Initial visibility: currently defaults to autocollapse

To set this template's initial visibility, the |state= parameter may be used:

  • |state=collapsed: {{Lua programming language|state=collapsed}} to show the template collapsed, i.e., hidden apart from its title bar
  • |state=expanded: {{Lua programming language|state=expanded}} to show the template expanded, i.e., fully visible
  • |state=autocollapse: {{Lua programming language|state=autocollapse}}
    • shows the template collapsed to the title bar if there is a {{navbar}}, a {{sidebar}}, or some other table on the page with the collapsible attribute
    • shows the template in its expanded state if there are no other collapsible items on the page

If the |state= parameter in the template on this page is not set, the template's initial visibility is taken from the |default= parameter in the Collapsible option template. For the template on this page, that currently evaluates to autocollapse.