Lua接口/客户端函数索引:修订间差异
来自天龙知识库
跳到导航跳到搜索
新建客户端 Lua 接口页:全局函数、对象方法、窗口操作与客户端事件 |
新建客户端 Lua 接口页:全局函数、对象方法、窗口操作与客户端事件 |
||
| (未显示2个用户的2个中间版本) | |||
| 第1行: | 第1行: | ||
__NOTOC__ | __NOTOC__ | ||
<div class="lua-reference | <div class="lua-reference"> | ||
[[首页|首页]] · [[Lua接口/客户端函数索引|客户端接口]] · [[Lua接口/客户端窗口操作|窗口操作]] · [[Lua接口/客户端事件|客户端事件]] | [[首页|首页]] · [[Lua接口/客户端函数索引|客户端接口]] · [[Lua接口/客户端窗口操作|窗口操作]] · [[Lua接口/客户端事件|客户端事件]] | ||
<div | <div class="lua-index-head"> | ||
<div role="heading" aria-level="2" | <div role="heading" aria-level="2" class="lua-title">客户端 Lua 接口</div> | ||
<div>面向客户端脚本的接口参考:全局函数与对象方法。客户端脚本负责界面与本地表现,实际数据以服务器下发为准。</div> | <div>面向客户端脚本的接口参考:全局函数与对象方法。客户端脚本负责界面与本地表现,实际数据以服务器下发为准。</div> | ||
<div | <div class="lua-sub-lg">213 个全局函数 · 64 个对象类(1344 个方法)· 338 个客户端事件 · 230 个界面脚本</div> | ||
</div> | </div> | ||
== 调用方式 == | == 调用方式 == | ||
* 全局函数直接按名称调用,例如 <code | * 全局函数直接按名称调用,例如 <code>ShowSystemInfo("文本")</code>。 | ||
* 对象方法要先取得对象再用冒号调用,例如 <code | * 对象方法要先取得对象再用冒号调用,例如 <code>local n = DataPool:GetFriendCount()</code>。 | ||
* <code | * <code>this</code> 是当前窗口对象,脚本里的 <code>this:RegisterEvent("事件名")</code>、<code>this:Show()</code> 属于[[Lua接口/客户端窗口操作|窗口操作]]。 | ||
* 事件名在[[Lua接口/客户端事件|客户端事件]]中查阅。 | * 事件名在[[Lua接口/客户端事件|客户端事件]]中查阅。 | ||
| 第17行: | 第17行: | ||
共 213 个,直接作为全局名调用,全部函数见[[Lua接口/客户端函数索引/全局函数|全局函数清单]]。清单里每个函数名都可点进独立页,查看参数含义、返回值与脚本中的真实调用。 | 共 213 个,直接作为全局名调用,全部函数见[[Lua接口/客户端函数索引/全局函数|全局函数清单]]。清单里每个函数名都可点进独立页,查看参数含义、返回值与脚本中的真实调用。 | ||
{| class="wikitable | {| class="wikitable" | ||
! scope="col" | ! scope="col" class="lua-w18" | 分组 | ||
! scope="col" | ! scope="col" class="lua-w10" | 函数数 | ||
! scope="col | ! scope="col" | 说明 | ||
|- | |- | ||
| [[Lua接口/客户端函数索引/全局函数|界面与提示]] | |||
| 77 | |||
| CallScriptString、CloseAllWindow、CloseBooth、CloseFangDaohao 等 | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/全局函数|角色、物品与对象]] | |||
| 17 | |||
| AcceptRide、AskDetailByGuid、AskEquipDetial、AskEvaluateAndLevelup 等 | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/全局函数|系统与设置]] | |||
| 17 | |||
| ClearAllTimer、KillTimer、PlaySound、QuitApplication 等 | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/全局函数|其他]] | |||
| 102 | |||
| AnswerLevelUpCode、AutoHit、AutoRunToTarget、AxTrace 等 | |||
|} | |} | ||
| 第42行: | 第42行: | ||
对象方法按对象分组;对象名就是脚本里冒号前使用的名称。共 35 个对象类、1200 个方法。每个方法名都可点进独立页,查看参数含义、返回值与脚本中的真实调用。 | 对象方法按对象分组;对象名就是脚本里冒号前使用的名称。共 35 个对象类、1200 个方法。每个方法名都可点进独立页,查看参数含义、返回值与脚本中的真实调用。 | ||
{| class="wikitable | {| class="wikitable" | ||
! scope="col" | ! scope="col" class="lua-w26" | 对象 | ||
! scope="col | ! scope="col" | | ||
|- | |- | ||
| [[Lua接口/客户端函数索引/DataPool|DataPool]] | |||
| <small class="lua-muted">实现类 DataPool · 181 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Pet|Pet]] | |||
| <small class="lua-muted">实现类 Pet · 163 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/PlayerShop|PlayerShop]] | |||
| <small class="lua-muted">实现类 PlayerShop · 87 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Player|Player]] | |||
| <small class="lua-muted">实现类 PlayerMySelf · 75 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/GameProduceLogin|GameProduceLogin]] | |||
| <small class="lua-muted">实现类 CGameProduce_Login · 69 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/LifeAbility|LifeAbility]] | |||
| <small class="lua-muted">实现类 LifeAbility · 61 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Guild|Guild]] | |||
| <small class="lua-muted">实现类 Guild · 54 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/TargetPet|TargetPet]] | |||
| <small class="lua-muted">实现类 TargetPet · 48 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/GuildLeague|GuildLeague]] | |||
| <small class="lua-muted">实现类 GuildLeague · 47 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/City|City]] | |||
| <small class="lua-muted">实现类 CityTable · 45 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Talk|Talk]] | |||
| <small class="lua-muted">实现类 Talk · 43 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Target|Target]] | |||
| <small class="lua-muted">实现类 Character · 38 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/SystemSetup|SystemSetup]] | |||
| <small class="lua-muted">实现类 SystemSetup · 36 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/StallSale|StallSale]] | |||
| <small class="lua-muted">实现类 StallSale · 28 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/SuperTooltips|SuperTooltips]] | |||
| <small class="lua-muted">实现类 SuperTooltips · 27 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/PlayerPackage|PlayerPackage]] | |||
| <small class="lua-muted">实现类 PlayerPackage · 25 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Exchange|Exchange]] | |||
| <small class="lua-muted">实现类 Exchange · 24 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/StallBuy|StallBuy]] | |||
| <small class="lua-muted">实现类 StallBuy · 19 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Bank|Bank]] | |||
| <small class="lua-muted">实现类 Bank · 17 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/NpcShop|NpcShop]] | |||
| <small class="lua-muted">实现类 NpcShop · 16 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Friend|Friend]] | |||
| <small class="lua-muted">实现类 Friend · 16 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/CActionItem|CActionItem]] | |||
| <small class="lua-muted">实现类 CActionItem · 13 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/FindFriendDataPool|FindFriendDataPool]] | |||
| <small class="lua-muted">实现类 CFindFriendDataPool · 10 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/PetInviteFriend|PetInviteFriend]] | |||
| <small class="lua-muted">实现类 PetInviteFriend · 9 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/FriendSearcher|FriendSearcher]] | |||
| <small class="lua-muted">实现类 FriendSearcher · 8 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/AbilityTeacher|AbilityTeacher]] | |||
| <small class="lua-muted">实现类 AbilityTeacher · 7 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/CommisionShop|CommisionShop]] | |||
| <small class="lua-muted">实现类 CommisionShop · 7 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/MissionReply|MissionReply]] | |||
| <small class="lua-muted">实现类 MissionReply · 6 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/StallBbs|StallBbs]] | |||
| <small class="lua-muted">实现类 StallBbs · 5 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Blog|Blog]] | |||
| <small class="lua-muted">实现类 Blog · 3 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/GemCarve|GemCarve]] | |||
| <small class="lua-muted">实现类 GemCarve · 3 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Sound|Sound]] | |||
| <small class="lua-muted">实现类 CSoundSystemFMod · 3 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Helper|Helper]] | |||
| <small class="lua-muted">实现类 CHelperSystem · 3 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/GemMelting|GemMelting]] | |||
| <small class="lua-muted">实现类 GemMelting · 2 个方法</small> | |||
|- | |- | ||
| [[Lua接口/客户端函数索引/Variable|Variable]] | |||
| <small class="lua-muted">实现类 CVariableSystem · 2 个方法</small> | |||
|} | |} | ||
窗口控件类(29 个类、144 个方法)见[[Lua接口/客户端窗口操作|客户端窗口操作]],其中的方法同样各有独立页。 | 窗口控件类(29 个类、144 个方法)见[[Lua接口/客户端窗口操作|客户端窗口操作]],其中的方法同样各有独立页。 | ||
== 界面脚本 == | |||
界面上的每个功能面板(钱庄、宝石镶嵌、摆摊、珍兽…)都由 <code>Data/Interface/</code> 下的一个 <code>.lua</code> 脚本负责,共 234 个。想知道某个功能对应哪个客户端文件(<code>.lua</code> 脚本与 <code>.layout.xml</code> 布局),见[[Lua接口/客户端界面索引|客户端界面索引]]。 | |||
== 约定 == | == 约定 == | ||
* 参数个数与类型由实现体推断:客户端实现没有结构化注释块,类型来自 <code | * 参数个数与类型由实现体推断:客户端实现没有结构化注释块,类型来自 <code>args[n].Is/Get*</code> 或 <code>lua_is*/lua_to*</code> 的取值点,取不到类型的参数会缺失。 | ||
* **独立页的标题是「归属:名称」**:全局函数直接是函数名,对象方法是 <code | * **独立页的标题是「归属:名称」**:全局函数直接是函数名,对象方法是 <code>对象名:方法名</code>,窗口控件方法是 <code>控件类:方法名</code>。同名方法可能存在于多个类(如 <code>Show</code> 同属 <code>Window</code> 与 <code>CUIWindowItem</code>),因此必须带归属前缀才能唯一定位。 | ||
* 返回项数来自 <code | * 返回项数来自 <code>return n</code>,<code>return 0</code> 表示无返回值(赋值接收得到 nil)。 | ||
* 每行下方标注的是**实现体所在的源码文件**,可按函数名回查核对;不标行号,避免源码改动后失效。 | * 每行下方标注的是**实现体所在的源码文件**,可按函数名回查核对;不标行号,避免源码改动后失效。 | ||
* 数字 0 与 -1 在 Lua 条件判断中都是真值,判断成功必须用明确比较。 | * 数字 0 与 -1 在 Lua 条件判断中都是真值,判断成功必须用明确比较。 | ||
2026年9月19日 (六) 17:16的最新版本
客户端 Lua 接口
面向客户端脚本的接口参考:全局函数与对象方法。客户端脚本负责界面与本地表现,实际数据以服务器下发为准。
213 个全局函数 · 64 个对象类(1344 个方法)· 338 个客户端事件 · 230 个界面脚本
调用方式
- 全局函数直接按名称调用,例如
ShowSystemInfo("文本")。 - 对象方法要先取得对象再用冒号调用,例如
local n = DataPool:GetFriendCount()。 this是当前窗口对象,脚本里的this:RegisterEvent("事件名")、this:Show()属于窗口操作。- 事件名在客户端事件中查阅。
全局函数
共 213 个,直接作为全局名调用,全部函数见全局函数清单。清单里每个函数名都可点进独立页,查看参数含义、返回值与脚本中的真实调用。
| 分组 | 函数数 | 说明 |
|---|---|---|
| 界面与提示 | 77 | CallScriptString、CloseAllWindow、CloseBooth、CloseFangDaohao 等 |
| 角色、物品与对象 | 17 | AcceptRide、AskDetailByGuid、AskEquipDetial、AskEvaluateAndLevelup 等 |
| 系统与设置 | 17 | ClearAllTimer、KillTimer、PlaySound、QuitApplication 等 |
| 其他 | 102 | AnswerLevelUpCode、AutoHit、AutoRunToTarget、AxTrace 等 |
对象方法
对象方法按对象分组;对象名就是脚本里冒号前使用的名称。共 35 个对象类、1200 个方法。每个方法名都可点进独立页,查看参数含义、返回值与脚本中的真实调用。
| 对象 | |
|---|---|
| DataPool | 实现类 DataPool · 181 个方法 |
| Pet | 实现类 Pet · 163 个方法 |
| PlayerShop | 实现类 PlayerShop · 87 个方法 |
| Player | 实现类 PlayerMySelf · 75 个方法 |
| GameProduceLogin | 实现类 CGameProduce_Login · 69 个方法 |
| LifeAbility | 实现类 LifeAbility · 61 个方法 |
| Guild | 实现类 Guild · 54 个方法 |
| TargetPet | 实现类 TargetPet · 48 个方法 |
| GuildLeague | 实现类 GuildLeague · 47 个方法 |
| City | 实现类 CityTable · 45 个方法 |
| Talk | 实现类 Talk · 43 个方法 |
| Target | 实现类 Character · 38 个方法 |
| SystemSetup | 实现类 SystemSetup · 36 个方法 |
| StallSale | 实现类 StallSale · 28 个方法 |
| SuperTooltips | 实现类 SuperTooltips · 27 个方法 |
| PlayerPackage | 实现类 PlayerPackage · 25 个方法 |
| Exchange | 实现类 Exchange · 24 个方法 |
| StallBuy | 实现类 StallBuy · 19 个方法 |
| Bank | 实现类 Bank · 17 个方法 |
| NpcShop | 实现类 NpcShop · 16 个方法 |
| Friend | 实现类 Friend · 16 个方法 |
| CActionItem | 实现类 CActionItem · 13 个方法 |
| FindFriendDataPool | 实现类 CFindFriendDataPool · 10 个方法 |
| PetInviteFriend | 实现类 PetInviteFriend · 9 个方法 |
| FriendSearcher | 实现类 FriendSearcher · 8 个方法 |
| AbilityTeacher | 实现类 AbilityTeacher · 7 个方法 |
| CommisionShop | 实现类 CommisionShop · 7 个方法 |
| MissionReply | 实现类 MissionReply · 6 个方法 |
| StallBbs | 实现类 StallBbs · 5 个方法 |
| Blog | 实现类 Blog · 3 个方法 |
| GemCarve | 实现类 GemCarve · 3 个方法 |
| Sound | 实现类 CSoundSystemFMod · 3 个方法 |
| Helper | 实现类 CHelperSystem · 3 个方法 |
| GemMelting | 实现类 GemMelting · 2 个方法 |
| Variable | 实现类 CVariableSystem · 2 个方法 |
窗口控件类(29 个类、144 个方法)见客户端窗口操作,其中的方法同样各有独立页。
界面脚本
界面上的每个功能面板(钱庄、宝石镶嵌、摆摊、珍兽…)都由 Data/Interface/ 下的一个 .lua 脚本负责,共 234 个。想知道某个功能对应哪个客户端文件(.lua 脚本与 .layout.xml 布局),见客户端界面索引。
约定
- 参数个数与类型由实现体推断:客户端实现没有结构化注释块,类型来自
args[n].Is/Get*或lua_is*/lua_to*的取值点,取不到类型的参数会缺失。 - **独立页的标题是「归属:名称」**:全局函数直接是函数名,对象方法是
对象名:方法名,窗口控件方法是控件类:方法名。同名方法可能存在于多个类(如Show同属Window与CUIWindowItem),因此必须带归属前缀才能唯一定位。 - 返回项数来自
return n,return 0表示无返回值(赋值接收得到 nil)。 - 每行下方标注的是**实现体所在的源码文件**,可按函数名回查核对;不标行号,避免源码改动后失效。
- 数字 0 与 -1 在 Lua 条件判断中都是真值,判断成功必须用明确比较。
- 客户端函数只影响本机界面与本地数据,不改变服务器状态。
- 未在游戏内执行验证,编号类参数与取值需按本服实机确认。