/**
     * Load an lua file.
     *
     * @param string strFile - The file name without extension.
     * @return bool - true if success, otherwise false.
     */
    public bool DoFile(string strFile)
    {
        if (string.IsNullOrEmpty(strFile))
        {
            return(false);
        }

        // Try to do file.
        try
        {
            // The lua file return the table itself.
            object cChunk = YwLuaScriptMng.Instance.LuaSvr.luaState.doFile(strFile);
            if ((null == cChunk) || !(cChunk is LuaTable))
            {
                return(false);
            }

            // Remember lua table.
            m_cLuaTableOpt = new YwLuaTable((LuaTable)cChunk);
            return(true);
        }
        catch (System.Exception e)
        {
            YwDebug.LogError(YwLuaSvr.FormatException(e));
        }

        return(false);
    }
    /**
     * Create a lua class instance for monobehavior instead of do a file.
     *
     * @param string strFile - The lua class name.
     * @return bool - true if success, otherwise false.
     */
    public bool CreateClassInstance(string strClassName)
    {
        if (string.IsNullOrEmpty(strClassName))
        {
            return(false);
        }

        // Try to get global lua class.
        try
        {
            // Get class first.
            LuaTable cClsTable = (LuaTable)YwLuaScriptMng.Instance.LuaSvr.luaState[strClassName];
            if (null == cClsTable)
            {
                return(false);
            }

            // Get "new" method of the lua class to create instance.
            LuaFunction cNew = (LuaFunction)cClsTable["new"];
            if (null == cNew)
            {
                return(false);
            }

            // We choose no default init parameter for constructor.
            object cInsChunk = cNew.call();
            if (null == cInsChunk)
            {
                return(false);
            }

            // If we create instance ok, use it as table.
            m_cLuaTableOpt = new YwLuaTable((LuaTable)cInsChunk);
            return(true);
        }
        catch (System.Exception e)
        {
            YwDebug.LogError(YwLuaSvr.FormatException(e));
        }

        return(false);
    }
    /**
     * Load an lua file.
     *
     * @param string strFile - The file name without extension.
     * @return bool - true if success, otherwise false.
     */
    public bool DoFile(string strFile)
    {
        if (string.IsNullOrEmpty(strFile))
        {
            return false;
        }

        // Try to do file.
        try
        {
            // The lua file return the table itself.
            object cChunk = YwLuaScriptMng.Instance.LuaSvr.luaState.doFile(strFile);
            if ((null == cChunk) || !(cChunk is LuaTable))
            {
                return false;
            }

            // Remember lua table.
            m_cLuaTableOpt = new YwLuaTable((LuaTable)cChunk);
            return true;
        }
        catch (System.Exception e)
        {
            YwDebug.LogError(YwLuaSvr.FormatException(e));
        }

        return false;
    }
    /**
     * Create a lua class instance for monobehavior instead of do a file.
     *
     * @param string strFile - The lua class name.
     * @return bool - true if success, otherwise false.
     */
    public bool CreateClassInstance(string strClassName)
    {
        if (string.IsNullOrEmpty(strClassName))
        {
            return false;
        }

        // Try to get global lua class.
        try
        {
            // Get class first.
            LuaTable cClsTable = (LuaTable)YwLuaScriptMng.Instance.LuaSvr.luaState[strClassName];
            if (null == cClsTable)
            {
                return false;
            }

            // Get "new" method of the lua class to create instance.
            LuaFunction cNew = (LuaFunction)cClsTable["new"];
            if (null == cNew)
            {
                return false;
            }

            // We choose no default init parameter for constructor.
            object cInsChunk = cNew.call();
            if (null == cInsChunk)
            {
                return false;
            }

            // If we create instance ok, use it as table.
            m_cLuaTableOpt = new YwLuaTable((LuaTable)cInsChunk);
            return true;
        }
        catch (System.Exception e)
        {
            YwDebug.LogError(YwLuaSvr.FormatException(e));
        }

        return false;
    }