/// <summary> /// Asynchronously loads a Lua/MoonSharp script from a System.IO.Stream. NOTE: This will *NOT* close the stream! /// /// This method is supported only on .NET 4.x and .NET 4.x PCL targets. /// </summary> /// <param name="script">The script.</param> /// <param name="stream">The stream containing code.</param> /// <param name="globalTable">The global table to bind to this chunk.</param> /// <param name="codeFriendlyName">Name of the code - used to report errors, etc.</param> /// <returns> /// A DynValue containing a function which will execute the loaded code. /// </returns> public static Task <DynValue> LoadStreamAsync(this Script script, Stream stream, Table globalTable = null, string codeFriendlyName = null) { return(ExecAsync(() => script.LoadStream(stream, globalTable, codeFriendlyName))); }