คุณอาจจะต้องการสร้างคู่มือการใช้งานของนี้ ผู้เขียนสามารถทำการทดลองได้ที่กระบะทราย (สร้าง | คัดลอก) และชุดทดสอบ (สร้าง) ของมอดูลนี้ โปรดเพิ่มหมวดหมู่ไปที่หน้าย่อย |
local function pack(...) return {...}, select('#', ...) end local function mapArray(func, array, count) local result = {} for i = 1, count or #array do result[i] = func(array[i]) end return result end local function quote(value) if type(value) == 'string' then return (string.gsub(string.format('%q', value), '\\\n', '\\n')) -- Outer parentheses remove second value returned by gsub end local str = tostring(value) if type(value) == 'table' and str ~= 'table' then return '{' .. str .. '}' end return str end local function callAssert(func, funcName, ...) local result, resultCount = pack(func(...)) if not result[1] then local args, argsCount = pack(...) args = mapArray(quote, args, argsCount) local message = mw.ustring.format( '%s(%s) failed', funcName, table.concat(args, ', ') ) error(message, 2) end return unpack(result, 1, resultCount) end return callAssert
wikipedia, แบบไทย, วิกิพีเดีย, วิกิ หนังสือ, หนังสือ, ห้องสมุด, บทความ, อ่าน, ดาวน์โหลด, ฟรี, ดาวน์โหลดฟรี, mp3, วิดีโอ, mp4, 3gp, jpg, jpeg, gif, png, รูปภาพ, เพลง, เพลง, หนัง, หนังสือ, เกม, เกม, มือถือ, โทรศัพท์, Android, iOS, Apple, โทรศัพท์โมบิล, Samsung, iPhone, Xiomi, Xiaomi, Redmi, Honor, Oppo, Nokia, Sonya, MI, PC, พีซี, web, เว็บ, คอมพิวเตอร์
khumuxkarichnganmxdul srang khunxaccatxngkarsrangkhumuxkarichngankhxngmxdulni phuekhiynsamarththakarthdlxngidthikrabathray srang khdlxk aelachudthdsxb srang khxngmxdulni oprdephimhmwdhmuipthihnayxy doc hnayxykhxngmxdulnilocal function pack return select end local function mapArray func array count local result for i 1 count or array do result i func array i end return result end local function quote value if type value string then return string gsub string format q value n n Outer parentheses remove second value returned by gsub end local str tostring value if type value table and str table then return str end return str end local function callAssert func funcName local result resultCount pack func if not result 1 then local args argsCount pack args mapArray quote args argsCount local message mw ustring format s s failed funcName table concat args error message 2 end return unpack result 1 resultCount end return callAssert ekhathungcak https th wikipedia org w index php title mxdul CallAssert amp oldid 9009764