<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 點號與冒號操作符的區別 > 看下面示例代碼: ~~~ local str = "abcde" print("case 1:", str:sub(1, 2)) print("case 2:", str.sub(str, 1, 2)) ~~~ > output: ~~~ case 1: ab case 2: ab ~~~ 冒號操作會帶入一個`self`參數,用來代表`自己`。而點號操作,只是`內容`的展開。 在函數定義時,使用冒號將默認接收一個`self`參數,而使用點號則需要顯式傳入`self`參數。 示例代碼: ~~~ obj={x=20} function obj:fun1() print(self.x) end ~~~ 等價于 ~~~ obj={x=20} function obj.fun1(self) print(self.x) end ~~~ 參見[ 官方文檔 ](http://www.lua.org/manual/5.1/manual.html#2.5.9)中的以下片段:“ The colon syntax is used for defining methods, that is, functions that have an implicit extra parameter self. Thus, the statement ~~~ function t.a.b.c:f (params) body end ~~~ is syntactic sugar for ~~~ t.a.b.c.f = function (self, params) body end ~~~ ” 冒號的操作,只有當變量是類對象時才需要。有關如何使用Lua構造類,大家可參考相關章節。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看