remove TERMINAL.OUT.STYLE

This commit is contained in:
rhpidfyre 2025-01-02 02:29:30 -05:00
parent da2fe5d88e
commit 3ff1b6d1e8
2 changed files with 13 additions and 15 deletions

View File

@ -26,13 +26,13 @@ macro_rules! background_styles_luau {
} }
pub trait TerminalColors { pub trait TerminalColors {
fn var_terminal_colors_background(&self, style_table: &Table) -> lResult<()>; fn background(&self, style_table: &Table) -> lResult<()>;
fn var_terminal_colors_foreground(&self, style_table: &Table) -> lResult<()>; fn foreground(&self, style_table: &Table) -> lResult<()>;
fn var_terminal_text_styling(&self) -> lResult<Table>; fn styling(&self) -> lResult<Table>;
fn var_terminal(&self) -> lResult<()>; fn terminal(&self) -> lResult<()>;
} }
impl TerminalColors for Vm { impl TerminalColors for Vm {
fn var_terminal_colors_foreground(&self, style_table: &Table) -> lResult<()> { fn background(&self, style_table: &Table) -> lResult<()> {
let foreground_table = self.0.create_table()?; let foreground_table = self.0.create_table()?;
foreground_styles_luau!(self, foreground_table, foreground_styles_luau!(self, foreground_table,
dark_grey dark_red dark_green dark_cyan dark_grey dark_red dark_green dark_cyan
@ -50,7 +50,7 @@ impl TerminalColors for Vm {
Ok(()) Ok(())
} }
fn var_terminal_colors_background(&self, style_table: &Table) -> lResult<()> { fn foreground(&self, style_table: &Table) -> lResult<()> {
let background_table = self.0.create_table()?; let background_table = self.0.create_table()?;
background_styles_luau!(self, background_table, background_styles_luau!(self, background_table,
on_dark_grey on_dark_red on_dark_green on_dark_cyan on_dark_grey on_dark_red on_dark_green on_dark_cyan
@ -64,18 +64,16 @@ impl TerminalColors for Vm {
Ok(()) Ok(())
} }
fn var_terminal_text_styling(&self) -> lResult<Table> { fn styling(&self) -> lResult<Table> {
let color_table = self.0.create_table()?;
let style_table = self.0.create_table()?; let style_table = self.0.create_table()?;
self.var_terminal_colors_foreground(&style_table)?; self.foreground(&style_table)?;
self.var_terminal_colors_background(&style_table)?; self.background(&style_table)?;
color_table.set("STYLE", style_table)?; Ok(style_table)
Ok(color_table)
} }
fn var_terminal(&self) -> lResult<()> { fn terminal(&self) -> lResult<()> {
let term_table = self.0.create_table()?; let term_table = self.0.create_table()?;
term_table.set("OUT", self.var_terminal_text_styling()?)?; term_table.set("OUT", self.styling()?)?;
self.0.globals().set("TERMINAL", &term_table)?; self.0.globals().set("TERMINAL", &term_table)?;
Ok(()) Ok(())
} }

View File

@ -69,7 +69,7 @@ impl Vm {
self.print()?; self.print()?;
self.printraw()?; self.printraw()?;
self.version()?; self.version()?;
self.var_terminal()?; self.terminal()?;
self.0.globals().set("getfenv", mlua::Nil)?; self.0.globals().set("getfenv", mlua::Nil)?;
self.0.globals().set("setfenv", mlua::Nil)?; self.0.globals().set("setfenv", mlua::Nil)?;
self.0.sandbox(true)?; self.0.sandbox(true)?;