mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-05 12:12:28 +00:00
Add Sleep API to redbean (#220)
This commit is contained in:
parent
64d87d4e5a
commit
f7b4804251
2 changed files with 10 additions and 0 deletions
|
@ -864,6 +864,10 @@ FUNCTIONS
|
||||||
Slurp(filename:str) → str
|
Slurp(filename:str) → str
|
||||||
Reads file data from local file system.
|
Reads file data from local file system.
|
||||||
|
|
||||||
|
Sleep(seconds:number)
|
||||||
|
Sleeps the specified number of seconds (can be fractional). The
|
||||||
|
smallest interval is a millisecond.
|
||||||
|
|
||||||
Route([host:str,[path:str]])
|
Route([host:str,[path:str]])
|
||||||
Instructs redbean to follow the normal HTTP serving path. This
|
Instructs redbean to follow the normal HTTP serving path. This
|
||||||
function is useful when writing an OnHttpRequest handler, since
|
function is useful when writing an OnHttpRequest handler, since
|
||||||
|
|
|
@ -4885,6 +4885,11 @@ static int LuaLog(lua_State *L) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int LuaSleep(lua_State *L) {
|
||||||
|
usleep(1000000 * luaL_checknumber(L, 1));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int LuaIsHiddenPath(lua_State *L) {
|
static int LuaIsHiddenPath(lua_State *L) {
|
||||||
size_t n;
|
size_t n;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -5267,6 +5272,7 @@ static const luaL_Reg kLuaFuncs[] = {
|
||||||
{"Sha256", LuaSha256}, //
|
{"Sha256", LuaSha256}, //
|
||||||
{"Sha384", LuaSha384}, //
|
{"Sha384", LuaSha384}, //
|
||||||
{"Sha512", LuaSha512}, //
|
{"Sha512", LuaSha512}, //
|
||||||
|
{"Sleep", LuaSleep}, //
|
||||||
{"Slurp", LuaSlurp}, //
|
{"Slurp", LuaSlurp}, //
|
||||||
{"StoreAsset", LuaStoreAsset}, //
|
{"StoreAsset", LuaStoreAsset}, //
|
||||||
{"Underlong", LuaUnderlong}, //
|
{"Underlong", LuaUnderlong}, //
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue