User:Fivesteaks: Difference between revisions

From All The Fallen Stories
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Test pages:
Test pages:
[[Module:FivesteaksPersistentTest]]
[[Module:FivesteaksPersistentTest]]
 
[[User:Fivesteaks/PersistentReadTest]]
(Code to be included, if/when proc_open is enabled:)
  local p = {}
 
  function p.FSStore( frame )
      _G.FivesteaksPersistentTest = "Testing Persistent Variables"
  end
 
  function p.FSShow( frame )
      return _G.FivesteaksPersistentTest
  end
 
  return p
 
 
----
 
Lua test:
<lua>
function bottle(x)
  if x > 1 then
    return x .. " bottles of beer"
  elseif x == 1 then
    return "One bottle of beer"
  else
    return "No more bottles of beer"
  end
end
 
function count(x)
  output = "<pre>"
  for beer = x, 1, -1 do
    output = output .. bottle(beer) .. " on the wall,\n"
    output = output .. bottle(beer) .. ",\n"
    output = output .. "Take one down, pass it around,\n"
    output = output .. bottle(beer-1) .. " on the wall.\n"
    output = output .. "\n\n"
  end
  return output .. "</pre>"
end
</lua>
 
==99 Bottles of Beer==
{{#luaexpr:count(99)}}

Latest revision as of 19:40, 5 November 2016