mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add lua exit(code)
This commit is contained in:
parent
c5dac4fd33
commit
e1e3e298bf
3 changed files with 16 additions and 0 deletions
|
|
@ -237,6 +237,9 @@ In addition to the Lua API tio makes the following functions available:
|
|||
|
||||
Protocol can be any of XMODEM_1K, XMODEM_CRC, YMODEM.
|
||||
|
||||
exit(code)
|
||||
Exit with code.
|
||||
|
||||
high(line)
|
||||
Set tty line high.
|
||||
|
||||
|
|
|
|||
|
|
@ -389,6 +389,8 @@ Send string.
|
|||
Send file using x/y-modem protocol.
|
||||
|
||||
Protocol can be any of XMODEM_1K, XMODEM_CRC, YMODEM.
|
||||
.IP "\fBexit(code)"
|
||||
Exit with exit code.
|
||||
.IP "\fBhigh(line)"
|
||||
Set tty line high.
|
||||
.IP "\fBlow(line)"
|
||||
|
|
|
|||
11
src/script.c
11
src/script.c
|
|
@ -315,6 +315,16 @@ error:
|
|||
return 1;
|
||||
}
|
||||
|
||||
// lua: exit(code)
|
||||
static int exit_(lua_State *L)
|
||||
{
|
||||
long code = lua_tointeger(L, 1);
|
||||
|
||||
exit(code);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void script_buffer_run(lua_State *L, const char *script_buffer)
|
||||
{
|
||||
int error;
|
||||
|
|
@ -341,6 +351,7 @@ static const struct luaL_Reg tio_lib[] =
|
|||
{ "modem_send", modem_send},
|
||||
{ "send", send},
|
||||
{ "expect", expect},
|
||||
{ "exit", exit_},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue