mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Fix tab character at the start of a script causing it not to parse correctly (#72)
This commit is contained in:
parent
9e28822e8f
commit
7237b7819a
1 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,7 @@ use std::process::ExitCode;
|
|||
|
||||
use lua::task::{TaskScheduler, TaskSchedulerResumeExt, TaskSchedulerScheduleExt};
|
||||
use mlua::prelude::*;
|
||||
use mlua::Compiler as LuaCompiler;
|
||||
use tokio::task::LocalSet;
|
||||
|
||||
pub(crate) mod builtins;
|
||||
|
@ -68,6 +69,7 @@ impl Lune {
|
|||
) -> Result<ExitCode, LuaError> {
|
||||
// Create our special lune-flavored Lua object with extra registry values
|
||||
let lua = lua::create_lune_lua()?;
|
||||
let script_bytecode = LuaCompiler::default().compile(script_contents);
|
||||
// Create our task scheduler and all globals
|
||||
// NOTE: Some globals require the task scheduler to exist on startup
|
||||
let sched = TaskScheduler::new(lua)?.into_static();
|
||||
|
@ -75,7 +77,7 @@ impl Lune {
|
|||
importer::create(lua, self.args.clone())?;
|
||||
// Create the main thread and schedule it
|
||||
let main_chunk = lua
|
||||
.load(script_contents.as_ref())
|
||||
.load(script_bytecode)
|
||||
.set_name(script_name.as_ref())
|
||||
.into_function()?;
|
||||
let main_thread = lua.create_thread(main_chunk)?;
|
||||
|
|
Loading…
Reference in a new issue