Module:Sandbox/Al2der
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Sandbox/Al2der/doc
local p = {}
local function tableToString(t)
local key
local value
local result
result = ''
for key, value in pairs(t) do
if (tonumber(key) ~= nil) then
result = result .. ':table[' .. key .. '] is ' .. value .. '\n'
else
result = result .. ':table[\'' .. key .. '\'] is ' .. value .. '\n'
end
end
return result
end
function p.sequence()
local numbers = {
20,
40,
60,
80,
}
local result
result = ';sequence\n'
result = result .. tableToString(numbers)
return result
end
function p.dictionary()
local languages = {
['de'] = 'German',
['en'] = 'English',
['es'] = 'Spanish',
['fr'] = 'French',
['it'] = 'Italian',
['ja'] = 'Japanese',
['ko'] = 'Korean',
['ru'] = 'Russian',
['zh'] = 'Zhou',
['ny'] = 'Bronx',
}
local result
result = ';dictionary\n'
result = result .. tableToString(languages)
return result
end
return p