diff options
| author | gyoder <70408179+gyoder@users.noreply.github.com> | 2025-07-11 12:19:26 -0600 |
|---|---|---|
| committer | gyoder <70408179+gyoder@users.noreply.github.com> | 2025-07-11 12:19:26 -0600 |
| commit | 4144fa2cba9732c1cee39b44b38f3752aefc4c03 (patch) | |
| tree | 5d6434b1f6f85591a448fc28d53b7e4f712c7b66 /htmlua-parser/src/render.rs | |
| parent | c8ffbb2af0eae39b897ff3b1b6c8263181fdd8d4 (diff) | |
Added Basic HTTP stdlibhttpstdlib
Diffstat (limited to 'htmlua-parser/src/render.rs')
| -rw-r--r-- | htmlua-parser/src/render.rs | 25 |
1 files changed, 1 insertions, 24 deletions
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<RefCell<String>>) -> mlua::Result<Table> { - 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<NodeRef> { let lua = Lua::new(); |
