Autocomplete and event listeners

Hello,

I was just wondering if there is a way to get autocomplete to recognise the event parameter for an event listener function. E.g. If we have:

local touch = function(event)  
 local x = event.phase  
end  
  
object:addEventListener("touch", touch)  

LUA glider doesn’t know what event is so doesn’t offer any autocomplete options.

I know that you can tell Glider the parameter types by using the -- @param syntax, so perhaps it’s possible using that?

Finally, in the SDK options i’m currently unable to select either Gideros or Moai (which i intend to try at some point). Could you let me know how to re-enable these please.

Thanks,
Alan [import]uid: 150809 topic_id: 32316 reply_id: 332316[/import]

Hello Alan,

“I know that you can tell Glider the parameter types by using the – @param
Yes indeed, we made custom classes just for this purpose. Please note that triple dash (—) denotes a luadoc comment.

---@param event @class touchEvent  
local touch = function(event)  
 local x = event.phase  
end  
   
object:addEventListener("touch", touch)  

"Finally, in the SDK options i’m currently unable to select either Gideros or Moai "
These are still in beta. We are working on getting the generic Lua based stuff operational first before releasing these versions. Please let us know via email or the contact form on our website when you are ready for a beta key.

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32316 reply_id: 128804[/import]

Yay! Got it working now :slight_smile:

Thanks for the quick response, I was close before, but I think I was trying “@class event”, rather than “@class touchEvent”. This auto complete makes a big difference for me as I’m quite new to Corona (and LUA), so saves me from having to check the API docs every 5 mins.

Noted with regards to the Gideros and Moai support. I can wait till its official I think, just thought there was possibly something wrong with my installation.

Thanks again,
Alan

[import]uid: 150809 topic_id: 32316 reply_id: 128863[/import]

Hello Alan,

“I know that you can tell Glider the parameter types by using the – @param
Yes indeed, we made custom classes just for this purpose. Please note that triple dash (—) denotes a luadoc comment.

---@param event @class touchEvent  
local touch = function(event)  
 local x = event.phase  
end  
   
object:addEventListener("touch", touch)  

"Finally, in the SDK options i’m currently unable to select either Gideros or Moai "
These are still in beta. We are working on getting the generic Lua based stuff operational first before releasing these versions. Please let us know via email or the contact form on our website when you are ready for a beta key.

Regards,
M.Y. Developers [import]uid: 55057 topic_id: 32316 reply_id: 128804[/import]

Yay! Got it working now :slight_smile:

Thanks for the quick response, I was close before, but I think I was trying “@class event”, rather than “@class touchEvent”. This auto complete makes a big difference for me as I’m quite new to Corona (and LUA), so saves me from having to check the API docs every 5 mins.

Noted with regards to the Gideros and Moai support. I can wait till its official I think, just thought there was possibly something wrong with my installation.

Thanks again,
Alan

[import]uid: 150809 topic_id: 32316 reply_id: 128863[/import]