mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Scribunto: Print dbg arguments to console [#506]
This commit is contained in:
parent
e3dce04680
commit
5055f82d21
@ -23,15 +23,26 @@ public class Luaj_server_func_dbg extends VarArgFunction {
|
||||
private final Scrib_core core;
|
||||
public Luaj_server_func_dbg(Scrib_core v) {this.core = v;}
|
||||
public Varargs invoke(Varargs args) {
|
||||
// init bfrs
|
||||
byte dbg_separator = Byte_ascii.Tab;
|
||||
Bry_bfr dbg_bfr = Bry_bfr_.New();
|
||||
Bry_bfr html_bfr = Bry_bfr_.New();
|
||||
dbg_bfr.Add(core.Frame_current().Frame_ttl()).Add_byte(dbg_separator);
|
||||
html_bfr.Add_str_a7("<span class='xowa_dbg' style='color:red'>");
|
||||
|
||||
// loop args and add to bfrs
|
||||
int len = args.narg();
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
bfr.Add_str_a7("<span class='xowa_dbg' style='color:red'>");
|
||||
for (int i = 1; i <= len; ++i) {
|
||||
String s = args.arg(i).toString();
|
||||
bfr.Add_str_u8(gplx.langs.htmls.Gfh_utl.Escape_html_as_str(s) + " ");
|
||||
if (i != 1) dbg_bfr.Add_byte(dbg_separator);
|
||||
dbg_bfr.Add_str_u8(s);
|
||||
html_bfr.Add_str_u8(gplx.langs.htmls.Gfh_utl.Escape_html_as_str(s) + " ");
|
||||
}
|
||||
bfr.Add_str_a7("</span><br/>");
|
||||
core.Page().Html_data().Xtn_scribunto_dbg_(bfr.To_bry_and_clear());
|
||||
|
||||
// term bfrs and print
|
||||
html_bfr.Add_str_a7("</span><br/>");
|
||||
core.Page().Html_data().Xtn_scribunto_dbg_(html_bfr.To_bry_and_clear());
|
||||
gplx.core.consoles.Console_adp__sys.Instance.Write_str_w_nl_utf8(dbg_bfr.To_str_and_clear());
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user