User:Fivesteaks: Difference between revisions
Jump to navigation
Jump to search
Fivesteaks (talk | contribs) No edit summary |
Fivesteaks (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
Test pages: | Test pages: | ||
[[Module:FivesteaksPersistentTest]] | [[Module:FivesteaksPersistentTest]] | ||
(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 test: |
Revision as of 04:11, 1 November 2016
Test pages: Module:FivesteaksPersistentTest
(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 = "
" 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 .. "
"
end </lua>
99 Bottles of Beer
{{#luaexpr:count(99)}}