From 4144fa2cba9732c1cee39b44b38f3752aefc4c03 Mon Sep 17 00:00:00 2001 From: gyoder <70408179+gyoder@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:19:26 -0600 Subject: Added Basic HTTP stdlib --- htmlua-parser/src/render.rs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'htmlua-parser/src/render.rs') diff --git a/htmlua-parser/src/render.rs b/htmlua-parser/src/render.rs index 6444d60..1bb043b 100644 --- a/htmlua-parser/src/render.rs +++ b/htmlua-parser/src/render.rs @@ -12,32 +12,9 @@ use syntect::{ util::LinesWithEndings, }; -use crate::helpers::read_doc_from_file; +use crate::{helpers::read_doc_from_file, htmlua_stdlib::create_htmlua_stdlib}; -fn create_htmlua_stdlib(l: &Lua, stdout: &Rc>) -> mlua::Result { - let t = l.create_table()?; - // This cannot be the best way to do this - - let stdout_println = stdout.clone(); - t.set( - "println", - l.create_function(move |_, text: String| { - let mut stdout_ref = stdout_println.borrow_mut(); - writeln!(stdout_ref, "{text}").map_err(mlua::Error::external) - })?, - )?; - - let stdout_print = stdout.clone(); - t.set( - "print", - l.create_function(move |_, text: String| { - let mut stdout_ref = stdout_print.borrow_mut(); - write!(stdout_ref, "{text}").map_err(mlua::Error::external) - })?, - )?; - Ok(t) -} pub fn execute_lua(document: NodeRef) -> Result { let lua = Lua::new(); -- cgit v1.3.1