Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 1e7327b

Browse files
committed
libscript: Add MCScriptExecuteContext::GetArguments()
Add an accessor to get the current prepared opcode's arguments as a span.
1 parent 5914ce7 commit 1e7327b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

libscript/src/script-execute.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class MCScriptExecuteContext
5050

5151
// Return the list of arguments to the current opcode
5252
const uindex_t *GetArgumentList(void) const;
53+
54+
// Return the list of arguments to the current opcode
55+
MCSpan<const uindex_t> GetArguments() const;
5356

5457
// Fetch the type of the given register. The type of the register might
5558
// be nil, if it has no assigned type.
@@ -348,6 +351,13 @@ MCScriptExecuteContext::GetArgumentList(void) const
348351
return m_arguments;
349352
}
350353

354+
inline MCSpan<const uindex_t>
355+
MCScriptExecuteContext::GetArguments() const
356+
{
357+
MCAssert(m_operation_ready);
358+
return MCMakeSpan(GetArgumentList(), GetArgumentCount());
359+
}
360+
351361
inline index_t
352362
MCScriptExecuteContext::GetSignedArgument(uindex_t p_index) const
353363
{

0 commit comments

Comments
 (0)