Skip to content

Commit 4f68d58

Browse files
committed
Engine: Add getter for script map
1 parent 9aa7150 commit 4f68d58

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/engine/engine.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ void Engine::setExtensions(const std::vector<std::string> &newExtensions)
432432
}
433433
}
434434

435+
/*! Returns the map of scripts (each top level block has a Script object). */
436+
const std::unordered_map<std::shared_ptr<Block>, std::shared_ptr<Script>> &Engine::scripts() const
437+
{
438+
return m_scripts;
439+
}
440+
435441
/*! Returns the block with the given ID. */
436442
std::shared_ptr<Block> Engine::getBlock(std::string id)
437443
{

src/engine/engine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ class LIBSCRATCHCPP_EXPORT Engine
6666
std::vector<std::string> extensions() const;
6767
void setExtensions(const std::vector<std::string> &newExtensions);
6868

69+
const std::unordered_map<std::shared_ptr<Block>, std::shared_ptr<Script>> &scripts() const;
70+
6971
private:
7072
std::shared_ptr<Block> getBlock(std::string id);
7173
std::shared_ptr<Variable> getVariable(std::string id);

0 commit comments

Comments
 (0)