MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_initreadline

Function lua_initreadline

third-party/lua-5.5.0/src/lua.c:500–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498#include <dlfcn.h>
499
500static void lua_initreadline (lua_State *L) {
501 void *lib = dlopen(LUA_READLINELIB, RTLD_NOW | RTLD_LOCAL);
502 if (lib == NULL)
503 lua_warning(L, "library '" LUA_READLINELIB "' not found", 0);
504 else {
505 const char **name = cast(const char**, dlsym(lib, "rl_readline_name"));
506 if (name != NULL)
507 *name = "lua";
508 l_readline = cast(l_readlineT, cast_func(dlsym(lib, "readline")));
509 l_addhist = cast(l_addhistT, cast_func(dlsym(lib, "add_history")));
510 if (l_readline == NULL)
511 lua_warning(L, "unable to load 'readline'", 0);
512 }
513}
514
515#else /* }{ */
516/* no dlopen or LUA_READLINELIB undefined */

Callers 2

doREPLFunction · 0.85
doREPLFunction · 0.85

Calls 1

lua_warningFunction · 0.70

Tested by

no test coverage detected