Skip to content

Commit

Permalink
isSubst
Browse files Browse the repository at this point in the history
  • Loading branch information
javalc6 committed Jun 14, 2023
1 parent 336ebbe commit 0ab740a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public ScribuntoLuaEngine(WikiPage wp) {
}
}

public String invoke(String moduleName, String functionName, Frame parent, Map<String, String> params, boolean trace_calls) throws ScribuntoException {
public String invoke(String moduleName, String functionName, Frame parent, Map<String, String> params, boolean isSubst, boolean trace_calls) throws ScribuntoException {
if (debug || trace_calls) {
System.out.println("invoke, moduleName="+moduleName+", functionName="+functionName);
for(Map.Entry<String,String> entry : params.entrySet()) {
Expand All @@ -112,7 +112,7 @@ public String invoke(String moduleName, String functionName, Frame parent, Map<S
throw new ScribuntoException(e);
}
}
final Frame frame = new Frame(module_label + moduleName, params, parent, true);
final Frame frame = new Frame(module_label + moduleName, params, parent, isSubst);
final LuaValue function = loadFunction(functionName, prototype, frame);

return executeFunctionChunk(function, frame);
Expand Down Expand Up @@ -336,7 +336,7 @@ public LuaValue call(LuaValue frameId, LuaValue function, LuaValue args) {
private LuaValue isSubsting() {
return new ZeroArgFunction() {
@Override public LuaValue call() {
return LuaValue.valueOf(true);
return LuaValue.valueOf(getFrameById(toLuaString("current")).isSubsting());
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion wiki/TemplateParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public String getParsedTemplate(String identifier, WikiPage wp, Map<String, Stri
parameterMap.forEach((name, value) -> System.out.print(name + (value.isEmpty() ? "" : " = " + value) + ", "));
System.out.println(")");
}
Frame frame = new Frame(template_label + identifier, parameterMap, parent, true);//frame of this template
Frame frame = new Frame(template_label + identifier, parameterMap, parent, false);//frame of this template
StringBuilder sb = new StringBuilder();
WikiScanner sh = new WikiScanner(delete_comments(template_text));
template_body(sh, sb, wp, frame);
Expand Down
2 changes: 1 addition & 1 deletion wiki/parserfunctions/Invoke.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String evaluate(WikiPage wp, ArrayList<String> parameters, Frame parent)
if (trace_calls)
System.out.println("MODULE:" + module_name + "." + function_name + "(" + parameterMap + ")");
try {
return sle.invoke(module_name, function_name, parent, parameterMap, trace_calls);
return sle.invoke(module_name, function_name, parent, parameterMap, false, trace_calls);
} catch (LuaError | ScribuntoException ex) {
if (!trace_calls)
System.out.println("MODULE:" + module_name + "." + function_name + "(" + parameterMap + ")");
Expand Down

0 comments on commit 0ab740a

Please sign in to comment.