This commit is contained in:
sxyazi 2024-03-30 22:14:37 +08:00
parent 6570c06f5d
commit 3d2f62ae59
No known key found for this signature in database

View file

@ -33,11 +33,11 @@ impl Utils {
lua.create_function(|lua, ()| { lua.create_function(|lua, ()| {
let block = lua.named_registry_value::<RtRef>("rt")?.next_block(); let block = lua.named_registry_value::<RtRef>("rt")?.next_block();
lua.create_async_function(move |lua, args: Variadic<Value>| async move { lua.create_async_function(move |lua, args: Variadic<Value>| async move {
if let Some(cur) = lua.named_registry_value::<RtRef>("rt")?.current.clone() { let Some(cur) = lua.named_registry_value::<RtRef>("rt")?.current.clone() else {
return Err("`ya.sync()` must be called in a plugin").into_lua_err();
};
Self::retrieve(cur, block, args).await Self::retrieve(cur, block, args).await
} else {
Err("`ya.sync()` must be called in a plugin").into_lua_err()
}
}) })
})?, })?,
)?; )?;