API

Framework API hints

Affects completion only, not breakpoints.

How it works

LuaDebug parses Lua itself, then loads framework API description files (plain Lua plus comment tags) according to luadebug.apiType, so engine methods show up in completion.

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

The example defines a module and a method; tags drive type inference. The style matches game Lua, plus tags.

Set apiType

  1. Open Settings and search luadebug.apiType.
  2. Pick per project: none / cocos2dx2 / cocos2dx3 / cocos2dx4 / ulua / slua / xlua.
  3. For multiple projects, set this in workspace settings. Reload the window after changing it.

Built-in & custom API files

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

  1. Create a folder under the script root and put your own API Lua there.
  2. Make sure it is indexed (inside scriptRoots and not ignored).
  3. Describe types with tags; see Tags.

Generating API from bindings (outline)

You can scan engine bindings or C# exports and generate tagged Lua API files. For this product:

If API hints look wrong, first check apiType and that the workspace is the current project.