<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://www.waylee.net/index.php?action=history&amp;feed=atom&amp;title=Lua%E6%8E%A5%E5%8F%A3%2F%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A</id>
	<title>Lua接口/服务端调用约定 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://www.waylee.net/index.php?action=history&amp;feed=atom&amp;title=Lua%E6%8E%A5%E5%8F%A3%2F%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A"/>
	<link rel="alternate" type="text/html" href="https://www.waylee.net/index.php?title=Lua%E6%8E%A5%E5%8F%A3/%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A&amp;action=history"/>
	<updated>2026-09-07T13:46:54Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://www.waylee.net/index.php?title=Lua%E6%8E%A5%E5%8F%A3/%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A&amp;diff=1229&amp;oldid=prev</id>
		<title>雪舞：​维护服务端 Lua 接口：核对参数、返回值、边界条件与调用示例</title>
		<link rel="alternate" type="text/html" href="https://www.waylee.net/index.php?title=Lua%E6%8E%A5%E5%8F%A3/%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A&amp;diff=1229&amp;oldid=prev"/>
		<updated>2026-09-07T11:53:16Z</updated>

		<summary type="html">&lt;p&gt;维护服务端 Lua 接口：核对参数、返回值、边界条件与调用示例&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw-interface=&quot;&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年9月7日 (一) 19:53的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l43&quot;&gt;第43行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第43行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Lua接口/服务端调用示例|常用调用示例]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Lua接口/服务端调用示例|常用调用示例]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== 调用问题 ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* [[Lua接口/函数不存在|函数不存在或提示 nil]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* [[Lua接口/参数类型与顺序|参数类型与传入顺序]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* [[Lua接口/返回值判断|返回值为 0、负数或空字符串]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* [[Lua接口/对象ID与GUID|对象 ID 与 GUID 的区别]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* [[Lua接口/服务端与客户端调用范围|服务端与客户端的调用范围]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>雪舞</name></author>
	</entry>
	<entry>
		<id>https://www.waylee.net/index.php?title=Lua%E6%8E%A5%E5%8F%A3/%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A&amp;diff=1206&amp;oldid=prev</id>
		<title>雪舞：​整理当前服务端 Lua 接口：注册名称、参数、返回值与调用说明</title>
		<link rel="alternate" type="text/html" href="https://www.waylee.net/index.php?title=Lua%E6%8E%A5%E5%8F%A3/%E6%9C%8D%E5%8A%A1%E7%AB%AF%E8%B0%83%E7%94%A8%E7%BA%A6%E5%AE%9A&amp;diff=1206&amp;oldid=prev"/>
		<updated>2026-09-07T11:16:13Z</updated>

		<summary type="html">&lt;p&gt;整理当前服务端 Lua 接口：注册名称、参数、返回值与调用说明&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
&amp;lt;div class=&amp;quot;lua-reference&amp;quot; style=&amp;quot;max-width:1200px;margin:0 auto;line-height:1.8;color:#29343a;font-family:Arial,&amp;#039;Microsoft YaHei&amp;#039;,sans-serif;letter-spacing:0;overflow-wrap:anywhere;&amp;quot;&amp;gt;&lt;br /&gt;
[[首页|首页]] · [[Lua接口/服务端函数索引|服务端接口]] · [[Lua接口/服务端调用约定|调用约定]]&lt;br /&gt;
&lt;br /&gt;
== 参数 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;table-layout:fixed;border-collapse:collapse;font-size:13px;&amp;quot;&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;text-align:left;background:#edf3f2;padding:8px;&amp;quot; | 参数类型&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; style=&amp;quot;text-align:left;background:#edf3f2;padding:8px;&amp;quot; | 约定&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;sceneId&amp;lt;/code&amp;gt;&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | 当前调用所处的场景编号。跨场景逻辑需通过对应接口完成。&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;selfId / targetId&amp;lt;/code&amp;gt;&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | 当前场景内的对象 ID，玩家、NPC 和怪物对象不能随意互换。&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;GUID&amp;lt;/code&amp;gt;&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | 角色或珍兽的全局唯一标识；与场景对象 ID 不同。&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;itemTypeSn / itemId&amp;lt;/code&amp;gt;&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | 物品配置编号，与背包格子位置不同。&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;number&amp;lt;/code&amp;gt;&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | 数值参数。布尔型开关若按数值读取，应使用约定的 0 或 1。&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;string&amp;lt;/code&amp;gt;&lt;br /&gt;
| style=&amp;quot;padding:8px;vertical-align:top;overflow-wrap:anywhere;&amp;quot; | 字符串参数。文字编码需与服务端脚本和客户端约定一致。&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
参数按位置传入，变量名可由脚本自行命名。并不是每个函数都以 sceneId、selfId 开头，例如 AddText 的第二个参数就是文字，AddItem 的第二个参数是物品编号。&lt;br /&gt;
&lt;br /&gt;
== 返回值 ==&lt;br /&gt;
* 无返回值与返回数字 0 不同。无返回值的函数被赋给变量时，变量得到 nil。&lt;br /&gt;
* Lua 中只有 nil 和 false 在条件判断中为假，数字 0 和 -1 都为真。&lt;br /&gt;
* 部分接口用 1 表示成功，部分接口返回对象编号、计数、错误码或多个值，必须查阅该函数的约定。&lt;br /&gt;
* 返回多个值时按顺序接收，例如 local x, z = GetWorldPos(sceneId, selfId)。&lt;br /&gt;
* 具有可变返回数量的接口，失败时可能只返回一项，其余接收变量为 nil。&lt;br /&gt;
&lt;br /&gt;
== 运行环境 ==&lt;br /&gt;
这些函数由游戏服务端注册，需在服务端脚本回调中调用。普通独立 Lua 环境或客户端脚本不保证存在同名函数。对象必须仍在相应场景中，并满足接口所要求的玩家、怪物或珍兽类型。&lt;br /&gt;
&lt;br /&gt;
== 名称 ==&lt;br /&gt;
注册名称保留原拼写。例如 &amp;lt;code style=&amp;quot;white-space:normal;overflow-wrap:anywhere;&amp;quot;&amp;gt;LuaFnSetLifeTimeAttrRefix_CriticalDefebce&amp;lt;/code&amp;gt; 中的 Defebce 是当前可调用名称，不应自行改写为 Defence。&lt;br /&gt;
&lt;br /&gt;
[[Lua接口/服务端调用示例|常用调用示例]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>雪舞</name></author>
	</entry>
</feed>