localp={}-- Credit to http://stackoverflow.com/a/1283608/2644759-- cc-by-sa 3.0localfunctiontableMerge(t1,t2,overwrite)fork,vinpairs(t2)doiftype(v)=="table"andtype(t1[k])=="table"then-- since type(t1[k]) == type(v) == "table", so t1[k] and v is truetableMerge(t1[k],v,overwrite)-- t2[k] == velseifoverwriteort1[k]==nilthent1[k]=vendendendreturnt1endfunctionp.loadI18n(name,i18n_arg)localexist,res=pcall(require,name)ifexistandnext(res)~=nilthenifi18n_argthentableMerge(i18n_arg,res.i18n,true)elseiftype(i18n)=="table"then-- merge to global i18ntableMerge(i18n,res.i18n,true)endendendfunctionp.loadI18nFrame(frame,i18n_arg)p.loadI18n(frame:getTitle().."/i18n",i18n_arg)endreturnp
เมษายน 21, 2022
มอด, i18n, อการใช, งานมอด, สร, าง, ณอาจจะต, องการสร, างค, อการใช, งานของมอด, ลน, เข, ยนสามารถทำการทดลองได, กระบะทราย, สร, าง, ดลอก, และช, ดทดสอบ, สร, าง, ของมอด, ลน, โปรดเพ, มหมวดหม, ไปท, หน, าย, อย, หน, าย, อยของมอด, ลน, local, credit, http, stackoverflow, 12. khumuxkarichnganmxdul srang khunxaccatxngkarsrangkhumuxkarichngankhxngmxdulniphuekhiynsamarththakarthdlxngidthikrabathray srang khdlxk aelachudthdsxb srang khxngmxdulnioprdephimhmwdhmuipthihnayxy doc hnayxykhxngmxdulnilocal p Credit to http stackoverflow com a 1283608 2644759 cc by sa 3 0 local function tableMerge t1 t2 overwrite for k v in pairs t2 do if type v table and type t1 k table then since type t1 k type v table so t1 k and v is true tableMerge t1 k v overwrite t2 k v else if overwrite or t1 k nil then t1 k v end end end return t1 end function p loadI18n name i18n arg local exist res pcall require name if exist and next res nil then if i18n arg then tableMerge i18n arg res i18n true elseif type i18n table then merge to global i18n tableMerge i18n res i18n true end end end function p loadI18nFrame frame i18n arg p loadI18n frame getTitle i18n i18n arg end return p ekhathungcak https th wikipedia org w index php title mxdul I18n amp oldid 8039314, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,