Module:Sandbox/Sware/test
Jump to navigation
Jump to search
p.sequence
function p.sequence()
This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.
p.dictionary
function p.dictionary()
This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.
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 = {10, 20, 30}
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'] = 'Chinese'
}
local result
result = ';dictionary\n'
result = result .. tableToString(languages)
return result
end
return p