Module:Test

local p = {}

--Hello, world! function p.hello( frame ) return "Hello, world!" end

--https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#table function p.tabletest( frame )

-- Create table t = {} t["foo"] = "foo" t.bar = "bar" t[1] = "one" t[2] = "two" t[3] = "three" t[12] = "the number twelve" t["12"] = "the string twelve" t[true] = "true" t[tonumber] = "yes, even functions may be table keys" t[t] = "yes, a table may be a table key too. Even in itself."

-- This creates a table roughly equivalent to the above t2 = { foo = "foo", bar = "bar", "one", "two", [12] = "the number twelve", ["12"] = "the string twelve", "three", [true] = "true", [tonumber] = "yes, even functions may be table keys", }   t2[t2] = "yes, a table may be a table key too. Even in itself." end

--Testing function p.test( frame ) -- https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual -- https://www.lua.org/cgi-bin/demo --Precondition: Assumes no spaces in the string --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Variables --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Frame_object local game = frame.args[1] local word = frame.args[2] local size = frame.args[3] game = game:upper if game == 'BOTW' then game = 'ALBW' end if size == nil or '' then size = '20' end --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#table local t = {} --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#string t[1] = ' ' --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Length_operator --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Control_structures local i = 1 repeat --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Function_calls --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#string.sub local char = word:sub(i,i) --local char = string.sub(word,i,i) --local char = word.sub(word,i,i) char = char:upper --char = string.upper(char) --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Control_structures --No case-switch in Lua --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Relational_operators --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Logical_operators --https://stackoverflow.com/questions/27633331/can-i-check-strings-equality-in-lua#27634079 local letter = char if    game == 'SS' then if    char == 'D' or char == 'W' then letter = 'DW' elseif char == 'E' or char == 'K' then letter = 'EK' elseif char == 'O' or char == 'Z' then letter = 'OZ' end elseif    game == 'ALBW' then if    char == 'D' or char == 'G' then letter = 'DG' elseif char == 'F' or char == 'R' then letter = 'FR' elseif char == 'J' or char == 'T' then letter = 'JT' elseif char == 'E' or char == 'W' then letter = 'EW' elseif char == 'O' or char == 'Z' then letter = 'OZ' end end local ext = 'png' if game == 'ALBW' then ext = 'svg' end

--https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Concatenation_operator t[i+1] = ' ' i = i+1 until( i > #word ) t[i+1] = ' ' --https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#table.concat return table.concat(t," ") end

return p