The docsearch function is now working.

This commit is contained in:
2026-01-14 14:34:54 -05:00
parent 850b4aa43b
commit 03e9928e03
6 changed files with 163 additions and 68 deletions

View File

@@ -933,11 +933,23 @@ LuaDefine(doc, "function",
std::ostream *ostream = w->lthread_print_stream();
LuaArg func;
LuaDefStack LS(L, func);
eng::string doc = w->get_source().function_docs(LS, func);
if (doc == "") {
(*ostream) << "no doc found" << std::endl;
bool ok = w->get_source().function_docs(LS, func, *ostream);
if (!ok) {
(*ostream) << "No documentation found.";
}
return LS.result();
}
LuaDefine(docsearch, "search-string", "Search the docs for the specified string") {
World *w = World::fetch_global_pointer(L);
std::ostream *ostream = w->lthread_print_stream();
LuaArg ss;
LuaDefStack LS(L, ss);
eng::string searchstring = LS.ckstring(ss);
bool ok = w->get_source().search_docs(searchstring, *ostream);
if (!ok) {
(*ostream) << "No documentation found.";
}
(*ostream) << doc;
return LS.result();
}