• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 505  文章 - 1034  trackbacks - 0
            <2006年11月>
            2930311234
            567891011
            12131415161718
            19202122232425
            262728293012
            3456789


            子曾經(jīng)曰過:編程無他,唯手熟爾!

            常用鏈接

            留言簿(94)

            隨筆分類(649)

            隨筆檔案(505)

            相冊(cè)

            BCB

            Crytek

            • crymod
            • Crytek's Offical Modding Portal

            Game Industry

            OGRE

            other

            Programmers

            Qt

            WOW Stuff

            搜索

            •  

            積分與排名

            • 積分 - 914456
            • 排名 - 14

            最新隨筆

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜


            學(xué)xml   http://www.w3schools.com/xml/default.asp

            我們游戲里界面和與界面有關(guān)的很多邏輯都是寫在xml里面的,其中邏輯使用lua寫,嵌在xml中,用xmlSpy編輯。

            xml中嵌入lua,比如
            <script>
            function max(a,b)
                if a 
            &gt; b then
                    return a;
                else
                    return b;
                end
            end
            </script>

            大于號(hào)   > 要寫成 &gt;  , 就是greater than的意思。同樣:
            小于號(hào)   <                &lt;            less than


            這樣子lua沒有高亮顯示,搞得我看起來很痛苦,晚上突發(fā)奇想,從*.lua文件里讀,就可以用LuaEdit來編輯了,那我就可以按F6來check syntax了,哈哈

            <script luafile="1" path="gui\haha.lua">
            </script>
            luafile 為 1,就讀path里的,為0就讀script節(jié)點(diǎn)的text,哈哈,爽!

            我從xml文件中把lua段粘貼到*.lua文件里時(shí),忘了把&gt;之類的符號(hào)換成 > 等,導(dǎo)致我查了很久,老子還跟蹤到luabind和lua的源代碼里面去,靠!faint!
            幸虧LuaEdit有Check Syntax功能,幫助我檢查到了錯(cuò)誤,深刻體會(huì)到了工具的好處,也更加堅(jiān)信“人與動(dòng)物的最大差別在于人類能夠制造工具并使用工具”!

            要是再整得能單步調(diào)試,那就爽歪歪了!



            All text in an XML document will be parsed by the parser.

            Only text inside a CDATA section will be ignored by the parser.


            Parsed Data

            XML parsers normally parse all the text in an XML document.

            When an XML element is parsed, the text between the XML tags is also parsed:

            <message>This text is also parsed</message>

            The parser does this because XML elements can contain other elements, as in this example, where the <name> element contains two other elements (first and last):

            <name><first>Bill</first><last>Gates</last></name>

            and the parser will break it up into sub-elements like this:

            <name>
                        <first>Bill</first>
                        <last>Gates</last>
                        </name>


            Escape Characters

            Illegal XML characters have to be replaced by entity references.

            If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element. You cannot write something like this:

            <message>if salary < 1000 then</message>

            To avoid this, you have to replace the "<" character with an entity reference, like this:

            <message>if salary &lt; 1000 then</message>

            There are 5 predefined entity references in XML:

            &lt; < less than
            &gt; > greater than
            &amp; & ampersand 
            &apos; ' apostrophe
            &quot; " quotation mark

            Note: Only the characters "<" and "&" are strictly illegal in XML. Apostrophes, quotation marks and greater than signs are legal, but it is a good habit to replace them.


            CDATA

            Everything inside a CDATA section is ignored by the parser.

            If your text contains a lot of "<" or "&" characters - as program code often does - the XML element can be defined as a CDATA section.

            A CDATA section starts with "<![CDATA[" and ends with "]]>":

            <script>
                        <![CDATA[
                        function matchwo(a,b)
                        {
                        if (a < b && a < 0) then
                        {
                        return 1
                        }
                        else
                        {
                        return 0
                        }
                        }
                        ]]>
                        </script>

            In the example above, everything inside the CDATA section is ignored by the parser.

            Notes on CDATA sections:

            A CDATA section cannot contain the string "]]>", therefore, nested CDATA sections are not allowed.

            Also make sure there are no spaces or line breaks inside the "]]>" string.


            posted on 2007-06-23 05:50 七星重劍 閱讀(2455) 評(píng)論(2)  編輯 收藏 引用 所屬分類: 亂七八糟

            FeedBack:
            # re: xml中嵌入lua 2007-06-25 11:45 yayv
            wow里不就這樣做的么
              回復(fù)  更多評(píng)論
              
            # re: xml中嵌入lua 2007-07-03 06:52 阿來
            @yayv
            最爽的就是后來我知道了wow居然是這么做的,真是"英雄所見略同"!哈哈   回復(fù)  更多評(píng)論
              
            亚洲欧美一级久久精品| 伊人久久无码中文字幕| 久久综合中文字幕| 亚洲国产成人久久精品动漫| 国产高潮国产高潮久久久91 | 久久国产亚洲精品无码| 国产精品久久一区二区三区| 久久久久亚洲爆乳少妇无 | 国产亚洲美女精品久久久| 久久久久亚洲精品无码网址 | 亚洲国产精品久久久久| 思思久久好好热精品国产| 无码AV波多野结衣久久| 国产精久久一区二区三区| 久久国产色av免费看| 久久精品国产99久久丝袜| 乱亲女H秽乱长久久久| 日产久久强奸免费的看| 久久精品9988| 久久婷婷五月综合色奶水99啪| 久久精品无码av| 999久久久免费国产精品播放| 久久香蕉国产线看观看精品yw| 一本久久a久久精品综合香蕉| 国产精品丝袜久久久久久不卡| 久久国产色AV免费观看| 亚洲精品午夜国产VA久久成人| 久久这里只精品99re66| 日批日出水久久亚洲精品tv| 亚洲狠狠综合久久| 日韩亚洲欧美久久久www综合网| 精品国产乱码久久久久久1区2区 | 亚洲欧美国产精品专区久久| 国产亚洲美女精品久久久| 国产成人久久777777| 久久伊人精品青青草原高清| 精品久久久久久久| 亚洲国产精品久久久久婷婷软件| 99久久亚洲综合精品成人| 99热精品久久只有精品| 国产精品美女久久久久av爽|