API

Framework API hints

Affects completion and navigation only, not breakpoints.

How it works

LuaDebug parses Lua, then loads framework API description files via luadebug.apiType (plain Lua + comment tags) to hint engine APIs.

--[[
  @SuperType [SomeFile#CCNode]
]]
CCPhysicsWorld = {}
--[[
  @return [SomeFile#CCPhysicsWorld]
]]
function CCPhysicsWorld:create(gx, gy) end

The sample defines a module and method; tags drive type inference. Same style as app code, plus tags.

Set apiType

  1. Open Settings and search luadebug.apiType.
  2. Pick for your project: none / cocos2dx2 / cocos2dx3 / cocos2dx4 / ulua / slua / xlua.
  3. For multiple projects use workspace settings; reload the window after changes.

Built-in and custom API files

The extension api/ folder ships common framework APIs. To override or extend:

  1. Create a folder under your script root and add custom API Lua files.
  2. Ensure it is indexed (inside scriptRoots and not ignored).
  3. Describe types with tags — see Tags.

Generating API from bindings / C# (overview)

Tools can scan engine bindings or C# exports into tagged Lua API files. Recommendations:

Wrong API hints: first check apiType and that the workspace points at the current project.