2.1.5
Added
- Added annotations and the
---@package
marker for script lifecycle snippets. The---@package
allows to hide lifecycle functions from the global context so that you don't get confused when choosing between a snippet and a real declared function with the same name. - Added the
script
snippet with theself
class definition and annotated lifecycle functions. Useful to create a script file with ready to useself
annotations. By default, the class is named by filename.
Note
- The definition of the
on_input.action
class exists in the updated defold-annotations release. So to makeon_input.action
available, please sync Defold API annotations via command pallete.
Example of output with the script
snippet in the player.script
file:
---@class player.script
---@package
---@param self player.script
function init(self)
end
---@package
---@param self player.script
---@param dt number
function update(self, dt)
end
---@package
---@param self player.script
---@param message_id hash
---@param message table
---@param sender hash
function on_message(self, message_id, message, sender)
end
---@package
---@param self player.script
---@param action_id hash
---@param action on_input.action
---@return boolean|nil
function on_input(self, action_id, action)
end
---@package
---@param self player.script
function final(self)
end