BadScript 2
Loading...
Searching...
No Matches
BadScriptDebuggerApi.cs
Go to the documentation of this file.
1using System.IO;
2
8
10
15{
19 private readonly BadScriptDebugger m_Debugger;
20
24 private readonly string m_DebuggerPath;
25
31 public BadScriptDebuggerApi(BadScriptDebugger debugger, string? path = null) : base("Debugger")
32 {
33 m_Debugger = debugger;
35 }
36
42 public void RegisterStep(BadExecutionContext context, BadFunction func)
43 {
44 m_Debugger.OnStep += s =>
45 {
46 foreach (BadObject _ in func.Invoke(
47 new[]
48 {
49 BadObject.Wrap(s),
50 },
51 context
52 ))
53 {
54 //Execute
55 }
56 };
57 }
58
65 {
66 m_Debugger.OnFileLoaded += s =>
67 {
68 foreach (BadObject _ in func.Invoke(
69 new BadObject[]
70 {
71 s,
72 },
73 context
74 ))
75 {
76 //Execute
77 }
78 };
79 }
80
81
83 protected override void LoadApi(BadTable target)
84 {
85 target.SetFunction<BadFunction>("RegisterStep", RegisterStep);
86 target.SetFunction<BadFunction>("RegisterOnFileLoaded", RegisterOnFileLoaded);
87 target.SetProperty("DebuggerPath", Path.GetFullPath(m_DebuggerPath));
88 }
89}
Implements the Debugger API for the Scriptable Debugger.
void RegisterOnFileLoaded(BadExecutionContext context, BadFunction func)
Registers a Function to the OnFileLoaded Event.
BadScriptDebuggerApi(BadScriptDebugger debugger, string? path=null)
Constructs a new BadScriptDebuggerApi instance.
readonly BadScriptDebugger m_Debugger
The Debugger Instance.
void RegisterStep(BadExecutionContext context, BadFunction func)
Registers a Function to the OnStep Event.
The Debugger Settings that are used by the Scriptable Debugger.
The Execution Context. Every execution of a script needs a context the script is running in....
Implements an Interop API for the BS2 Language.
The Base Class for all BadScript Objects.
Definition BadObject.cs:14
Implements a Table Structure for the BadScript Language.
Definition BadTable.cs:14
Implements a function that can be called from the script.
IEnumerable< BadObject > Invoke(BadObject[] args, BadExecutionContext caller)
Invokes the function with the specified arguments.
static T Instance
Returns the Instance of the Settings Provider.
Contains the scriptable debugger implementation for the BadScript2 Runtime.
Contains the Extension Classes for Functions.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains Runtime Function Objects.
Contains the Runtime Objects.
Definition BadArray.cs:10
Contains the Runtime Implementation.