示例#1
0
 /// <summary>
 /// Evaluates a boolean condition defined in Lua code.
 /// </summary>
 /// <returns>
 /// <c>true</c> if luaCode evaluates to true; otherwise, <c>false</c>.
 /// </returns>
 /// <param name='luaCondition'>
 /// The conditional expression to evaluate. Do not include "return" in front.
 /// </param>
 /// <param name='debug'>
 /// If <c>true</c>, logs the Lua command to the console.
 /// </param>
 /// <param name='allowExceptions'>
 /// If <c>true</c>, exceptions are passed up to the caller. Otherwise they're caught and ignored.
 /// </param>
 /// <example>
 /// if (Lua.IsTrue("height > 6")) { ... }
 /// </example>
 public static bool IsTrue(string luaCondition, bool debug, bool allowExceptions)
 {
     return(Tools.IsStringNullOrEmptyOrWhitespace(luaCondition) ? true : Run("return " + luaCondition, debug, allowExceptions).asBool);
 }