aboutsummaryrefslogtreecommitdiff
path: root/stand/liblua
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-09-01 17:06:19 +0000
committerWarner Losh <imp@FreeBSD.org>2022-09-01 17:08:22 +0000
commit29fc4075e69fd27de0cded313ac6000165d99f8b (patch)
tree85a715a3ef84984c8fc09429ed41861c2b8f7e4b /stand/liblua
parenta5948d40ad060140bf5b995f5409458a18ced0ce (diff)
Diffstat (limited to 'stand/liblua')
-rw-r--r--stand/liblua/lutils.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/stand/liblua/lutils.c b/stand/liblua/lutils.c
index 9243edd07e8f..1649ac9fd508 100644
--- a/stand/liblua/lutils.c
+++ b/stand/liblua/lutils.c
@@ -64,6 +64,21 @@ lua_command(lua_State *L)
}
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)
{
int argc;
@@ -539,9 +554,9 @@ static const struct luaL_Reg loaderlib[] = {
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),