15.082
Bearbeitungen
(fullpagename() moved to Modul:Wiki) |
(+ Kommentare) |
||
| Zeile 139: | Zeile 139: | ||
function p.append_tables(t1, t2) | function p.append_tables(t1, t2) | ||
-- append | -- append indexed/keyed table to another | ||
-- indexes/keys gonna lost! | |||
-- the result is table with new indexes | |||
-- also see p.merge_tables() | |||
local result={} | local result={} | ||
for _, v in pairs(t1) do | for _, v in pairs(t1) do | ||
| Zeile 161: | Zeile 164: | ||
function p.tableToString(tbl, indent) | function p.tableToString(tbl, indent) | ||
-- Prints a LUA-Table as string. Very useful if you want to see whats inside | -- Prints a LUA-Table as string. Very useful if you want to see whats inside | ||
-- to do: still neccessary? => mw.logObject() | |||
indent = indent or 0 | indent = indent or 0 | ||
local toprint = string.rep(" ", indent) .. "{\n" | local toprint = string.rep(" ", indent) .. "{\n" | ||
| Zeile 186: | Zeile 190: | ||
function p.shallowcopy(orig) | function p.shallowcopy(orig) | ||
-- real-copy of a table | |||
local orig_type = type(orig) | local orig_type = type(orig) | ||
local copy | local copy | ||
| Zeile 215: | Zeile 220: | ||
function p.isTrue(s) | function p.isTrue(s) | ||
-- testet String auf True-Werte verschiedenster Schreibweisen | |||
local result = false | local result = false | ||
if not p.isEmpty(s) then | if not p.isEmpty(s) then | ||