mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Scribunto: Make table accessible from datawrapper in mw.lua [#586]
This commit is contained in:
parent
bb86b026fe
commit
1bffdadbaf
@ -58,7 +58,7 @@ public class Xoh_make_fxt {
|
||||
}
|
||||
public void Expd__redlinks(String... ary) {
|
||||
int len = ary.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
Xopg_lnki_itm__hdump itm = new Xopg_lnki_itm__hdump(wiki.Ttl_parse(Bry_.new_u8(ary[i])));
|
||||
expd_redlinks.Add(itm);
|
||||
}
|
||||
|
@ -35,6 +35,14 @@ class Luaj_value_ {
|
||||
int rv_idx = 0;
|
||||
LuaValue cur = LuaValue.NIL; // needed for luaj iterator; tbl.next(cur);
|
||||
|
||||
// override tbl with xo_orig_table from mw.lua.dataWrapper; ISSUE#:586: DATE:2019-10-29
|
||||
LuaValue metatable_obj = tbl.getmetatable();
|
||||
if (metatable_obj != null && !metatable_obj.isnil()) {
|
||||
LuaValue orig_data_obj = ((LuaTable)metatable_obj).get("xo_orig_data");
|
||||
if (orig_data_obj != null && !orig_data_obj.isnil())
|
||||
tbl = (LuaTable)orig_data_obj;
|
||||
}
|
||||
|
||||
// loop over pairs in tbl; no direct way to get kvs
|
||||
while (true) {
|
||||
// get next itm
|
||||
|
@ -19,7 +19,11 @@ function mw.dump_table(o)
|
||||
if type(o) == 'table' then
|
||||
local s = '{ '
|
||||
for k,v in pairs(o) do
|
||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||
if type(k) == 'table' then
|
||||
k = mw.dump_table(k)
|
||||
elseif type(k) ~= 'number' then
|
||||
k = '"'..k..'"'
|
||||
end
|
||||
dump_table_count = dump_table_count + 1;
|
||||
s = s .. '['..k..'] = ' .. mw.dump_table(v) .. ','
|
||||
dump_table_count = dump_table_count - 1;
|
||||
@ -712,6 +716,7 @@ local function dataWrapper( data, seen )
|
||||
end
|
||||
|
||||
local mt = {
|
||||
xo_orig_data = data, -- tbl.next does not retrieve data from datawrapper; ISSUE#:586: DATE:2019-10-29
|
||||
mw_loadData = true,
|
||||
__index = function ( tt, k )
|
||||
assert( t == tt )
|
||||
|
Loading…
Reference in New Issue
Block a user