Files
lush/lcmd.h
Cormac Shannon f88b17959f Hide shell functions from _G using upvalues on the main chunk
Store __command, __interactive, __getenv, __setenv as upvalues
populated by lua_load() from the registry, keeping them invisible
to user code while accessible to the parser's codegen.
2026-03-12 22:46:56 +00:00

26 lines
644 B
C

/*
** $Id: lcmd.h $
** Command execution for backtick syntax
** See Copyright Notice in lua.h
*/
#ifndef lcmd_h
#define lcmd_h
#include "lua.h"
/* Upvalue indices for shell functions on the main chunk.
** Index 0 is _ENV (standard). Indices 1-4 are lush shell functions. */
#define LUSH_UPVAL_COMMAND 1
#define LUSH_UPVAL_INTERACTIVE 2
#define LUSH_UPVAL_GETENV 3
#define LUSH_UPVAL_SETENV 4
#define LUSH_NUM_UPVALS 5 /* total: _ENV(0) + 4 shell functions */
int lushCmd_command (lua_State *L);
int lushCmd_interactive (lua_State *L);
int lushCmd_getenv (lua_State *L);
int lushCmd_setenv (lua_State *L);
#endif