{"id":40251,"date":"2025-05-28T13:43:03","date_gmt":"2025-05-28T05:43:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/40251.html"},"modified":"2025-05-28T13:43:03","modified_gmt":"2025-05-28T05:43:03","slug":"nlua%e6%80%a7%e8%83%bd%e5%af%b9%e6%af%94%ef%bc%9ac%e6%b3%a8%e5%86%8c%e5%87%bd%e6%95%b0-vs-%e7%ba%aflua%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/40251.html","title":{"rendered":"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0"},"content":{"rendered":"<h4>\u5f15\u8a00<\/h4>\n<p>\u5728NLua\u5f00\u53d1\u4e2d&#xff0c;\u6211\u4eec\u5e38\u9762\u4e34\u4e00\u4e2a\u91cd\u8981\u9009\u62e9&#xff1a;\u5c06C#\u51fd\u6570\u6ce8\u518c\u5230Lua\u73af\u5883\u8c03\u7528&#xff0c;\u8fd8\u662f\u76f4\u63a5\u5728Lua\u4e2d\u5b9e\u73b0\u903b\u8f91&#xff1f; \u76f4\u89c9\u544a\u8bc9\u6211\u4eec&#xff0c;C#\u4f5c\u4e3a\u7f16\u8bd1\u578b\u8bed\u8a00\u6027\u80fd\u66f4\u9ad8&#xff0c;\u4f46\u8de8\u8bed\u8a00\u8c03\u7528\u7684\u5f00\u9500\u662f\u5426\u4f1a\u5f71\u54cd\u6574\u4f53\u6027\u80fd&#xff1f;\u672c\u6587\u901a\u8fc7\u57fa\u51c6\u6d4b\u8bd5\u63ed\u793a\u771f\u76f8\u3002<\/p>\n<hr \/>\n<h4>\u6d4b\u8bd5\u573a\u666f<\/h4>\n<p>\u5b9e\u73b0\u5b89\u5168\u7d22\u5f15\u8bbf\u95ee\u51fd\u6570At&#xff0c;\u5bf9\u6bd4\u4e09\u79cd\u5b9e\u73b0\u65b9\u5f0f&#xff1a;<\/p>\n<li>NativeLuaAt&#xff1a;\u7eafLua\u5b9e\u73b0<\/li>\n<li>CSharpRegisterAt&#xff1a;C#\u5b9e\u73b0\u5e76\u6ce8\u518c\u5230Lua<\/li>\n<li>NativeCSharpAt&#xff1a;\u7eafC#\u76f4\u63a5\u8c03\u7528<\/li>\n<p>\u6d4b\u8bd5\u73af\u5883&#xff1a;<\/p>\n<ul>\n<li>.NET Framework 4.8.1<\/li>\n<li>Intel Core i7-1260P<\/li>\n<li>BenchmarkDotNet v0.15.0<\/li>\n<\/ul>\n<hr \/>\n<h4>\u6027\u80fd\u6570\u636e\u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u65b9\u6cd5\u5e73\u5747\u8017\u65f6\u5185\u5b58\u5206\u914d<\/tr>\n<tbody>\n<tr>\n<td>NativeLuaAt<\/td>\n<td>6,844 ns<\/td>\n<td>288 B<\/td>\n<\/tr>\n<tr>\n<td>CSharpRegisterAt<\/td>\n<td>9,585 ns<\/td>\n<td>552 B<\/td>\n<\/tr>\n<tr>\n<td>NativeCSharpAt<\/td>\n<td>106 ns<\/td>\n<td>32 B<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250528054301-6836a2657964c.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<hr \/>\n<h4>\u7ed3\u8bba<\/h4>\n<p>\u51fa\u4e4e\u610f\u6599&#xff0c;\u76f4\u63a5\u5728Lua\u4e2d\u5b9e\u73b0\u903b\u8f91\u4f1a\u66f4\u5feb&#xff0c;\u8fd9\u91cc\u539f\u56e0\u53ef\u80fd\u662f\u5c06C#\u51fd\u6570\u6ce8\u518c\u5230Lua\u73af\u5883\u8c03\u7528\u6d89\u53ca\u5230\u4e0a\u4e0b\u6587\u5207\u6362\u7b49\u8017\u65f6\u52a8\u4f5c\u3002 \u76f8\u5173\u4ee3\u7801\u89c1NLuaBenchmarkDotNetTest<\/p>\n<h4>\u4ee3\u7801<\/h4>\n<p>Lua\u4ee3\u7801<\/p>\n<p><span class=\"token comment\">&#8211;[[<br \/>\n\u4ec5\u7528\u4e8euserdata\u7d22\u5f15\u8bbf\u95ee\u51fd\u6570&#xff0c;C#\u5b9a\u4e49<br \/>\n\u53c2\u6570&#xff1a;<br \/>\n  tbl  : \u76ee\u6807Lua\u8868&#xff08;\u6570\u7ec4\u5f62\u5f0f&#xff09;<br \/>\n  index: \u7d22\u5f15\u503c&#xff08;\u652f\u6301\u6b63\u8d1f\u7d22\u5f15&#xff09;<br \/>\n  strict: [\u53ef\u9009]\u4e25\u683c\u6a21\u5f0f&#xff0c;\u9ed8\u8ba4false&#xff0c;\u8bbe\u4e3atrue\u65f6\u989d\u5916\u6821\u9a8c\u5143\u7d20\u8fde\u7eed\u6027<br \/>\n\u8fd4\u56de\u503c&#xff1a;<br \/>\n  \u5bf9\u5e94\u7d22\u5f15\u4f4d\u7f6e\u7684\u5143\u7d20<br \/>\n\u5f02\u5e38&#xff1a;<br \/>\n  \u7c7b\u578b\u9519\u8bef\u6216\u7d22\u5f15\u8d8a\u754c\u65f6\u629b\u51fa\u9519\u8bef<br \/>\n&#8211;]]<\/span><br \/>\n<span class=\"token keyword\">function<\/span> <span class=\"token function\">At<\/span><span class=\"token punctuation\">(<\/span>tbl<span class=\"token punctuation\">,<\/span> index<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token comment\">&#8212; \u53c2\u6570\u6821\u9a8c\u9636\u6bb5 <\/span><br \/>\n    <span class=\"token comment\">&#8212; \u68c0\u67e5\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u5426\u4e3atable<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token function\">type<\/span><span class=\"token punctuation\">(<\/span>tbl<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">~&#061;<\/span> <span class=\"token string\">&#034;userdata&#034;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token function\">error<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;bad argument #1 (expected table, got &#034;<\/span><span class=\"token operator\">..<\/span><span class=\"token function\">type<\/span><span class=\"token punctuation\">(<\/span>tbl<span class=\"token punctuation\">)<\/span><span class=\"token operator\">..<\/span><span class=\"token string\">&#034;)&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">end<\/span><\/p>\n<p>    <span class=\"token comment\">&#8212; \u68c0\u67e5\u7d22\u5f15\u662f\u5426\u4e3a\u6574\u6570<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token function\">type<\/span><span class=\"token punctuation\">(<\/span>index<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">~&#061;<\/span> <span class=\"token string\">&#034;number&#034;<\/span> <span class=\"token keyword\">or<\/span> math<span class=\"token punctuation\">.<\/span><span class=\"token function\">floor<\/span><span class=\"token punctuation\">(<\/span>index<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">~&#061;<\/span> index <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token function\">error<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;index must be integer, got &#034;<\/span><span class=\"token operator\">..<\/span><span class=\"token function\">type<\/span><span class=\"token punctuation\">(<\/span>index<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">end<\/span><\/p>\n<p>    <span class=\"token comment\">&#8212; \u957f\u5ea6\u8ba1\u7b97\u7b56\u7565 <\/span><br \/>\n    <span class=\"token keyword\">local<\/span> len <span class=\"token operator\">&#061;<\/span> tbl<span class=\"token punctuation\">.<\/span>Length<\/p>\n<p>    <span class=\"token comment\">&#8212; \u4e25\u683c\u6a21\u5f0f\u4e0b\u9a8c\u8bc1\u8868\u8fde\u7eed\u6027<\/span><\/p>\n<p>    <span class=\"token comment\">&#8212; \u7d22\u5f15\u8f6c\u6362\u903b\u8f91 <\/span><br \/>\n    <span class=\"token keyword\">local<\/span> adjusted_index<\/p>\n<p>    <span class=\"token comment\">&#8212; \u5904\u7406\u6b63\u7d22\u5f15&#xff08;userdata\u662f \u76840-based&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> index <span class=\"token operator\">&gt;&#061;<\/span> <span class=\"token number\">0<\/span> <span class=\"token keyword\">then<\/span><br \/>\n        adjusted_index <span class=\"token operator\">&#061;<\/span> index<br \/>\n    <span class=\"token comment\">&#8212; \u5904\u7406\u8d1f\u7d22\u5f15&#xff08;\u4ece\u672b\u5c3e\u5012\u6570&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">else<\/span><br \/>\n        adjusted_index <span class=\"token operator\">&#061;<\/span> len <span class=\"token operator\">&#043;<\/span> index<br \/>\n    <span class=\"token keyword\">end<\/span><\/p>\n<p>    <span class=\"token comment\">&#8212; \u8fb9\u754c\u68c0\u67e5\u4e0e\u9519\u8bef\u5904\u7406 <\/span><br \/>\n    <span class=\"token comment\">&#8212; \u6709\u6548\u7d22\u5f15\u8303\u56f4&#xff1a;1 \u2264 index \u2264 len<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> adjusted_index <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">0<\/span> <span class=\"token keyword\">or<\/span> adjusted_index <span class=\"token operator\">&gt;&#061;<\/span> len <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token keyword\">local<\/span> direction <span class=\"token operator\">&#061;<\/span> index <span class=\"token operator\">&gt;&#061;<\/span><span class=\"token number\">0<\/span> <span class=\"token keyword\">and<\/span> <span class=\"token string\">&#034;positive&#034;<\/span> <span class=\"token keyword\">or<\/span> <span class=\"token string\">&#034;negative&#034;<\/span><br \/>\n        <span class=\"token function\">error<\/span><span class=\"token punctuation\">(<\/span>string<span class=\"token punctuation\">.<\/span><span class=\"token function\">format<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Index %d (%s) out of range [%d, %d]&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n                          index<span class=\"token punctuation\">,<\/span> direction<span class=\"token punctuation\">,<\/span> <span class=\"token operator\">&#8211;<\/span>len<span class=\"token punctuation\">,<\/span> len<span class=\"token operator\">&#8211;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">end<\/span><\/p>\n<p>    <span class=\"token comment\">&#8212; \u6700\u7ec8\u5143\u7d20\u83b7\u53d6 <\/span><br \/>\n    <span class=\"token keyword\">return<\/span> tbl<span class=\"token punctuation\">[<\/span>adjusted_index<span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token keyword\">end<\/span><\/p>\n<p>C#\u4ee3\u7801<\/p>\n<p>        \/\/\/ &lt;summary&gt;<br \/>\n        \/\/\/ \u5b89\u5168\u7d22\u5f15\u8bbf\u95ee\u5668&#xff08;\u652f\u6301Lua\u6570\u7ec4\u76840-based\u7d22\u5f15\u89c4\u5219&#xff09;<br \/>\n        \/\/\/ &lt;\/summary&gt;<br \/>\n        \/\/\/ &lt;param name&#061;&#034;collection&#034;&gt;\u76ee\u6807\u96c6\u5408&#xff08;\u652f\u6301IList\u63a5\u53e3\u7684\u96c6\u5408&#xff09;&lt;\/param&gt;<br \/>\n        \/\/\/ &lt;param name&#061;&#034;index&#034;&gt;\u7d22\u5f15\u503c&#xff08;\u652f\u6301\u8d1f\u7d22\u5f15\u5012\u67e5&#xff09;&lt;\/param&gt;<br \/>\n        \/\/\/ &lt;param name&#061;&#034;strict&#034;&gt;\u4e25\u683c\u6a21\u5f0f\u6821\u9a8c\u5143\u7d20\u8fde\u7eed\u6027&lt;\/param&gt;<br \/>\n        \/\/\/ &lt;returns&gt;\u7d22\u5f15\u4f4d\u7f6e\u7684\u5143\u7d20&lt;\/returns&gt;<br \/>\n        \/\/\/ &lt;exception cref&#061;&#034;ArgumentNullException&#034;&gt;\u8f93\u5165\u96c6\u5408\u4e3a\u7a7a&lt;\/exception&gt;<br \/>\n        \/\/\/ &lt;exception cref&#061;&#034;ArgumentException&#034;&gt;\u96c6\u5408\u7c7b\u578b\u4e0d\u5408\u6cd5\u6216\u7d22\u5f15\u65e0\u6548&lt;\/exception&gt;<br \/>\n        public static object At(IEnumerable collection, int index, bool strict &#061; false)<br \/>\n        {<br \/>\n            \/\/ \u53c2\u6570\u57fa\u7840\u6821\u9a8c<br \/>\n            if (collection &#061;&#061; null)<br \/>\n                throw new ArgumentNullException(nameof(collection), &#034;\u8f93\u5165\u96c6\u5408\u4e0d\u80fd\u4e3anull&#034;);<\/p>\n<p>            \/\/ \u7c7b\u578b\u5b89\u5168\u8f6c\u6362<br \/>\n            IList list &#061; collection as IList;<br \/>\n            if (list &#061;&#061; null)<br \/>\n                throw new ArgumentException(&#034;\u8f93\u5165\u96c6\u5408\u5fc5\u987b\u5b9e\u73b0IList\u63a5\u53e3&#034;, nameof(collection));<\/p>\n<p>            \/\/ \u83b7\u53d6\u6709\u6548\u957f\u5ea6<br \/>\n            int count &#061; list.Count;<br \/>\n            if (count &#061;&#061; 0)<br \/>\n                throw new ArgumentException(&#034;\u96c6\u5408\u4e2d\u4e0d\u5305\u542b\u6709\u6548\u5143\u7d20&#034;, nameof(collection));<\/p>\n<p>            \/\/ \u7d22\u5f15\u8f6c\u6362\u903b\u8f91<br \/>\n            int adjustedIndex &#061; index &gt;&#061; 0 ? index : count &#043; index;<\/p>\n<p>            \/\/ \u8fb9\u754c\u6821\u9a8c<br \/>\n            if (adjustedIndex &lt; 0 || adjustedIndex &gt;&#061; count)<br \/>\n            {<br \/>\n                string msg &#061; $&#034;\u7d22\u5f15 {index} \u8d85\u51fa\u6709\u6548\u8303\u56f4 [{-count}, {count &#8211; 1}]&#034;;<br \/>\n                throw new ArgumentOutOfRangeException(nameof(index), msg);<br \/>\n            }<\/p>\n<p>            \/\/ \u4e25\u683c\u6a21\u5f0f\u6821\u9a8c<br \/>\n            if (strict)<br \/>\n            {<br \/>\n                \/\/ \u6821\u9a8c\u662f\u5426\u5b58\u5728null\u5143\u7d20<br \/>\n                for (int i &#061; 0; i &lt; count; i&#043;&#043;)<br \/>\n                {<br \/>\n                    if (list[i] &#061;&#061; null)<br \/>\n                    {<br \/>\n                        throw new ArgumentException($&#034;\u4e25\u683c\u6a21\u5f0f\u68c0\u6d4b\u5230\u7a7a\u5143\u7d20 &#064; \u4f4d\u7f6e {i}&#034;);<br \/>\n                    }<br \/>\n                }<br \/>\n            }<\/p>\n<p>            return ConvertToDouble(list[adjustedIndex]);<br \/>\n        }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb373\u6b21\uff0c\u70b9\u8d5e2\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u672c\u6587\u5bf9\u6bd4\u4e86NLua\u5f00\u53d1\u4e2d\u4e0d\u540c\u5b9e\u73b0\u65b9\u5f0f\u7684\u6027\u80fd\u5dee\u5f02\u3002\u901a\u8fc7\u57fa\u51c6\u6d4b\u8bd5\u53d1\u73b0\uff0c\u7eafLua\u5b9e\u73b0\u7684At\u51fd\u6570(6,844 ns)\u6bd4C#\u6ce8\u518c\u5230Lua\u7684\u5b9e\u73b0(9,585 ns)\u66f4\u5feb\uff0c\u800c\u7eafC#\u8c03\u7528(106 ns)\u6027\u80fd\u6700\u4f18\u3002\u6d4b\u8bd5\u8868\u660e\u8de8\u8bed\u8a00\u8c03\u7528\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u5f00\u9500\u663e\u8457\uff0c\u5728\u6027\u80fd\u654f\u611f\u573a\u666f\u5e94\u4f18\u5148\u8003\u8651\u8bed\u8a00\u539f\u751f\u5b9e\u73b0\u3002\u5b8c\u6574\u4ee3\u7801\u5df2\u5f00\u6e90\uff0c\u4e3aNLua\u5f00\u53d1\u4e2d\u7684\u5b9e\u73b0\u9009\u62e9\u63d0\u4f9b\u6570\u636e\u53c2\u8003\u3002<\/p>\n","protected":false},"author":2,"featured_media":40250,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3681,55,1463],"topic":[],"class_list":{"0":"post-40251","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-server","8":"tag-c","10":"tag-lua"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/40251.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb373\u6b21\uff0c\u70b9\u8d5e2\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u672c\u6587\u5bf9\u6bd4\u4e86NLua\u5f00\u53d1\u4e2d\u4e0d\u540c\u5b9e\u73b0\u65b9\u5f0f\u7684\u6027\u80fd\u5dee\u5f02\u3002\u901a\u8fc7\u57fa\u51c6\u6d4b\u8bd5\u53d1\u73b0\uff0c\u7eafLua\u5b9e\u73b0\u7684At\u51fd\u6570(6,844 ns)\u6bd4C#\u6ce8\u518c\u5230Lua\u7684\u5b9e\u73b0(9,585 ns)\u66f4\u5feb\uff0c\u800c\u7eafC#\u8c03\u7528(106 ns)\u6027\u80fd\u6700\u4f18\u3002\u6d4b\u8bd5\u8868\u660e\u8de8\u8bed\u8a00\u8c03\u7528\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u5f00\u9500\u663e\u8457\uff0c\u5728\u6027\u80fd\u654f\u611f\u573a\u666f\u5e94\u4f18\u5148\u8003\u8651\u8bed\u8a00\u539f\u751f\u5b9e\u73b0\u3002\u5b8c\u6574\u4ee3\u7801\u5df2\u5f00\u6e90\uff0c\u4e3aNLua\u5f00\u53d1\u4e2d\u7684\u5b9e\u73b0\u9009\u62e9\u63d0\u4f9b\u6570\u636e\u53c2\u8003\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/40251.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-28T05:43:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250528054301-6836a2657964c.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/40251.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/40251.html\",\"name\":\"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-28T05:43:03+00:00\",\"dateModified\":\"2025-05-28T05:43:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/40251.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/40251.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/40251.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/40251.html","og_locale":"zh_CN","og_type":"article","og_title":"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb373\u6b21\uff0c\u70b9\u8d5e2\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u672c\u6587\u5bf9\u6bd4\u4e86NLua\u5f00\u53d1\u4e2d\u4e0d\u540c\u5b9e\u73b0\u65b9\u5f0f\u7684\u6027\u80fd\u5dee\u5f02\u3002\u901a\u8fc7\u57fa\u51c6\u6d4b\u8bd5\u53d1\u73b0\uff0c\u7eafLua\u5b9e\u73b0\u7684At\u51fd\u6570(6,844 ns)\u6bd4C#\u6ce8\u518c\u5230Lua\u7684\u5b9e\u73b0(9,585 ns)\u66f4\u5feb\uff0c\u800c\u7eafC#\u8c03\u7528(106 ns)\u6027\u80fd\u6700\u4f18\u3002\u6d4b\u8bd5\u8868\u660e\u8de8\u8bed\u8a00\u8c03\u7528\u7684\u4e0a\u4e0b\u6587\u5207\u6362\u5f00\u9500\u663e\u8457\uff0c\u5728\u6027\u80fd\u654f\u611f\u573a\u666f\u5e94\u4f18\u5148\u8003\u8651\u8bed\u8a00\u539f\u751f\u5b9e\u73b0\u3002\u5b8c\u6574\u4ee3\u7801\u5df2\u5f00\u6e90\uff0c\u4e3aNLua\u5f00\u53d1\u4e2d\u7684\u5b9e\u73b0\u9009\u62e9\u63d0\u4f9b\u6570\u636e\u53c2\u8003\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/40251.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-28T05:43:03+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250528054301-6836a2657964c.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/40251.html","url":"https:\/\/www.wsisp.com\/helps\/40251.html","name":"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-28T05:43:03+00:00","dateModified":"2025-05-28T05:43:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/40251.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/40251.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/40251.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"NLua\u6027\u80fd\u5bf9\u6bd4\uff1aC#\u6ce8\u518c\u51fd\u6570 vs \u7eafLua\u5b9e\u73b0"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/40251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=40251"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/40251\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/40250"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=40251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=40251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=40251"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=40251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}