pub fn make_utils_tbl(lua: &Lua) -> LuaResult<LuaTable> {
    let tbl = lua.create_table()?;

    tbl.set(
        "nvim_wrap_async",
        lua.create_function(|lua, (async_fn, millis): (LuaFunction, Option<u64>)| {
            nvim_wrap_async(lua, async_fn, millis.unwrap_or(NVIM_POLL_TIMEOUT))
        })?,
    )?;
    tbl.set(
        "wrap_async",
        lua.create_function(|lua, (async_fn, schedule_fn)| wrap_async(lua, async_fn, schedule_fn))?,
    )?;
    tbl.set("rand_u32", lua.create_function(|_, ()| rand_u32())?)?;

    Ok(tbl)
}
/// Makes a Lua table containing the utils functions
Makes a Lua table containing the utils functions
Makes a Lua table containing the utils functions
pub fn make_utils_tbl(lua: &Lua) -> LuaResult<LuaTable> {
    let tbl = lua.create_table()?;
    tbl.set(
        "nvim_wrap_async",
        lua.create_function(|lua, (async_fn, millis): (LuaFunction, Option<u64>)| {
            nvim_wrap_async(lua, async_fn, millis.unwrap_or(NVIM_POLL_TIMEOUT))
        })?,
    )?;
    tbl.set(
        "wrap_async",
        lua.create_function(|lua, (async_fn, schedule_fn)| wrap_async(lua, async_fn, schedule_fn))?,
    )?;
    tbl.set("rand_u32", lua.create_function(|_, ()| rand_u32())?)?;
    Ok(tbl)
}
pub fn make_utils_tbl ( lua : & Lua ) -> LuaResult < LuaTable > { let tbl = lua . create_table ( ) ? ; tbl . set ( " " , lua . create_function ( | lua , ( async_fn , millis ) : ( LuaFunction , Option < u64 > ) | { nvim_wrap_async ( lua , async_fn , millis . unwrap_or ( NVIM_POLL_TIMEOUT ) ) } ) ? , ) ? ; tbl . set ( " " , lua . create_function ( | lua , ( async_fn , schedule_fn ) | wrap_async ( lua , async_fn , schedule_fn ) ) ? , ) ? ; tbl . set ( " " , lua . create_function ( | _ , ( ) | rand_u32 ( ) ) ? ) ? ; Ok ( tbl ) }
Makes a Lua table containing the utils functions
Makes a Lua table containing the utils functions
lua
&Lua