Files
RobustToolbox/Robust.Shared/Toolshed/Commands/Generic/ListGeneration/ToCommand.cs
Leon Friedrich f81e30a031 Try fix invalid PVS index bug (#5422)
* Try fix invalid PVS index bug

* bounds check

* More Asserts

* fix assert?

* remove deletion

* a

* A!
2024-09-16 14:12:20 +10:00

20 lines
664 B
C#

using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using Robust.Shared.Toolshed.Syntax;
namespace Robust.Shared.Toolshed.Commands.Generic.ListGeneration;
[ToolshedCommand]
public sealed class ToCommand : ToolshedCommand
{
[CommandImplementation, TakesPipedTypeAsGeneric]
public IEnumerable<T> To<T>(
[CommandInvocationContext] IInvocationContext ctx,
[PipedArgument] T start,
[CommandArgument] ValueRef<T> end
)
where T : INumber<T>
=> Enumerable.Range(int.CreateTruncating(start), 1 + int.CreateTruncating(end.Evaluate(ctx)! - start)).Select(T.CreateTruncating);
}