Skip to content

Commit

Permalink
Add function exists function
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkail committed Aug 4, 2016
1 parent 1da7428 commit 6c6f349
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ink-engine-runtime/Story.cs
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,20 @@ public void ChooseChoiceIndex(int choiceIdx)
ChoosePath (choiceToChoose.choicePoint.choiceTarget.path);
}

/// <summary>
/// Checks if a function exists.
/// </summary>
/// <returns>True if the function exists, else false.</returns>
/// <param name="functionName">The name of the function as declared in ink.</param>
public bool FunctionExists (string functionName)
{
try {
return ContentAtPath (new Path (functionName)) is Runtime.Container;
} catch (StoryException e) {
return false
}
}

/// <summary>
/// Evaluates a function defined in ink.
/// </summary>
Expand Down

0 comments on commit 6c6f349

Please sign in to comment.