From 57596ae5312e97193f3ff50bd05ee472d2d25c9a Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Fri, 26 Apr 2024 21:54:55 +0200 Subject: [PATCH] Set lua warning function --- src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index fec2d33..3c2e401 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,7 +18,7 @@ use axum::{Json, Router}; use dotenvy::dotenv; use google_home::{GoogleHome, Request}; use rumqttc::AsyncClient; -use tracing::{debug, error, info}; +use tracing::{debug, error, info, warn}; #[derive(Clone)] struct AppState { @@ -81,6 +81,12 @@ async fn app() -> anyhow::Result<()> { // Lua testing { let lua = mlua::Lua::new(); + + lua.set_warning_function(|_lua, text, _cont| { + warn!("{text}"); + Ok(()) + }); + let automation = lua.create_table()?; automation.set("device_manager", device_manager.clone())?;