Skip to content

Commit 43da51e

Browse files
committed
minor improvements
1 parent edfcdaf commit 43da51e

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

info/bliki/extensions/scribunto/engine/lua/ScribuntoLuaEngine.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,11 @@ public LuaValue call(LuaValue luaValue) {
613613
}
614614
}
615615
});
616+
617+
// string.gfind was renamed to gmatch in 5.2
618+
LuaValue string = globals.get("string");
619+
string.set("gfind", string.get("gmatch"));
620+
616621
}
617622

618623
public static LuaString toLuaString(String string) {

info/bliki/extensions/scribunto/engine/lua/interfaces/MwTitle.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ public Varargs invoke(Varargs args) {
208208
}
209209

210210
private LuaValue title(LuaValue ns, LuaValue title, LuaValue fragment, LuaValue interwiki) {
211+
if (ns.isnil() || !ns.isint())
212+
ns = LuaValue.valueOf(0);
211213
LuaTable table = new LuaTable();
212214
table.set("isLocal", EMPTYSTRING);
213215
table.set("isRedirect", EMPTYSTRING);
214216
table.set("subjectNsText", EMPTYSTRING);
215217
table.set("interwiki", interwiki.isnil() ? EMPTYSTRING : interwiki);
216-
table.set("namespace", ns.isnil() ? LuaValue.valueOf(0) : ns);
217-
table.set("nsText", ns.isnil() ? LuaValue.EMPTYSTRING : toLuaString(getNameSpaceByNumber(ns.checkint())));
218+
table.set("namespace", ns);
219+
table.set("nsText", toLuaString(getNameSpaceByNumber(ns.checkint())));
218220
table.set("text", title);
219221
table.set("id", title);
220222
table.set("fragment", fragment.isnil() ? EMPTYSTRING : fragment);

0 commit comments

Comments
 (0)