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
- Open Settings and search
luadebug.apiType. - Pick for your project:
none/cocos2dx2/cocos2dx3/cocos2dx4/ulua/slua/xlua. - 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:
- Create a folder under your script root and add custom API Lua files.
- Ensure it is indexed (inside scriptRoots and not ignored).
- 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:
- Prefer the built-in
apiTypepacks; - Fill gaps with hand-written API + tags;
- Put generated files in the project and keep them indexed.
Wrong API hints: first check apiType and that the workspace points at the current project.