MCPcopy Create free account
hub / github.com/PlutoLang/Pluto / lua_initreadline

Function lua_initreadline

src/lua.cpp:510–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508#include <dlfcn.h>
509
510static void lua_initreadline (lua_State *L) {
511 void *lib = dlopen(LUA_READLINELIB, RTLD_NOW | RTLD_LOCAL);
512 if (lib == NULL)
513 lua_warning(L, "library '" LUA_READLINELIB "' not found", 0);
514 else {
515 const char **name = cast(const char**, dlsym(lib, "rl_readline_name"));
516 if (name != NULL)
517 *name = "lua";
518 l_readline = cast(l_readlineT, cast_func(dlsym(lib, "readline")));
519 l_addhist = cast(l_addhistT, cast_func(dlsym(lib, "add_history")));
520 if (l_readline == NULL)
521 lua_warning(L, "unable to load 'readline'", 0);
522 }
523}
524
525#else /* }{ */
526/* no dlopen or LUA_READLINELIB undefined */

Callers 1

doREPLFunction · 0.85

Calls 1

lua_warningFunction · 0.85

Tested by

no test coverage detected