diff --git a/stand/liblua/lutils.c b/stand/liblua/lutils.c --- a/stand/liblua/lutils.c +++ b/stand/liblua/lutils.c @@ -63,6 +63,21 @@ return 1; } +static int +lua_has_command(lua_State *L) +{ + const char *cmd; + + if (lua_gettop(L) != 1) { + lua_pushnil(L); + return 1; + } + cmd = luaL_checkstring(L, 1); + lua_pushinteger(L, interp_has_builtin_cmd(cmd)); + + return 1; +} + static int lua_perform(lua_State *L) { @@ -539,9 +554,9 @@ REG_SIMPLE(interpret), REG_SIMPLE(parse), REG_SIMPLE(getenv), + REG_SIMPLE(has_command), REG_SIMPLE(perform), - /* Also registered as the global 'printc' */ - REG_SIMPLE(printc), + REG_SIMPLE(printc), /* Also registered as the global 'printc' */ REG_SIMPLE(setenv), REG_SIMPLE(time), REG_SIMPLE(unsetenv),