Skip to content

Commit

Permalink
feat: add CLI argument of the script path
Browse files Browse the repository at this point in the history
  • Loading branch information
alanjian85 committed Jul 20, 2024
1 parent d82888a commit e56efeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pub struct Config {
/// The number of samples per pixel
#[arg(long, default_value_t = 10)]
pub samples: u32,

/// The path to the Lua script
pub script: String,
}

#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn main() {
let Size { width, height } = config.size;

let scripting = Scripting::new().unwrap();
let script = fs::read_to_string("scripts/scene.lua").unwrap();
let script = fs::read_to_string(&config.script).unwrap();
let (camera, scene) = scripting.load(&config, &script).unwrap();

let mut image = RgbImage::new(width, height);
Expand Down

0 comments on commit e56efeb

Please sign in to comment.