Defold-api-emmylua

I am a big fun of intellij idea. So i integrate defold api with it.

To use Idea with lua and defold your need.
1)Install lua plugin. EmmyLua https://plugins.jetbrains.com/plugin/9768-emmylua
2)Edit file associations. Press ctrl + shift + a. Then enter command Edit file associations. To lua language add .*script .*render_script .*gui_script.
3)Download defold api library.
I create a tool that parse defold docs and generate lua files with description.
You need download zip file Releases · d954mas/defold-api-emmylua · GitHub
4)Add library to your project.
File/Project structure/libraries/lua zip library.
5)Use it =)
2018-04-04_15-26-44

29 Likes

This is AWESOME!!! Thank you!

2 Likes

Thanks you! Fantastic work!

2 Likes

Emmylua is a very nice lua extension to idea and I use it with defold for a long time.

1 Like

And how to run and debug project from IDEA?

No way. We need write plugin for that.

2 Likes

@d954mas is there any way to set defold editor automatically reload file if it was changed in another program like idea does?

i write scripts, only in idea. Then run game from defold editor. I don’t edit script from defold and from IDEA in same time. If editor not automaticaly reload file, you should make issue for that.

1 Like

is it possible to use this in zerobrane ?

Is there any way to add a warning about using global variables in IDEA? The only thing that I found about it is this issue https://github.com/EmmyLua/IntelliJ-EmmyLua/issues/127 but it’s in Chinese and according to google translate EmmyLua doesn’t support it for now :frowning:

It has luacheck support. Rightclick your code and hit use luacheck. Itll open a prompt and ask you to point towards the luacheck exe

Actually you can even set it as an option. Hit ctrl + alt + s, go to editor/inspections/lua “global name can be local”

This one is just what I’ve looked for, thanks!

1 Like

How do i remove the upvalue underlining? its really distracting

edit: of course i ended up finding it right after asking (its under syntax highlighting)

Update:
1)fixed return value in api headers

 ---Creates a new zero vector with all components set to 0.
- ---@return v vector3 new zero vector
+ ---@return  vector3 new zero vector
 function vmath.vector3() end

2)add headers for vector3/vector4

3)update api to version 1.2.129

4 Likes

Update:
1)fix gui autocompile(replace - to _)

---@param line-break boolean true or false
function gui.set_line_break(node, line-break) end

2)fix luasocket autocompile ("*" as name)

---@param "*" string if address is "*"" and the object is connected, the peer association is removed and 
function connected:setpeername("*") end

3)Add timer autocomplite.(i add it by myself. Please add timer doc to docs @sven )
4)make class global. Idea will now autocomplite sprite, spine and etc. Before it autocomplite only their functions
5)Add jar and instruction to generate headers @AGulev

3 Likes

Update:
1)update api to version 1.2.136
2)timer api from from timer_doc.json

No more than 3 consecutive replies are allowed. Please edit your previous reply instead, or wait for someone to reply to you. LOL=) So update prev post.

Update:
1)update api to version 1.2.143
2)autocomplete returned tables(sys.get_sys_info() … )
3)autocomplete url fields(socket, path, fragment)
4)Add this project to asset page. https://www.defold.com/community/projects/128566/

2018-12-05_22-59-46

5 Likes

Update:
1)update api to version 1.2.160

2 Likes

Update:
1)update api to version 1.2.163

6 Likes

Update:
1)update api to version 1.2.169

3 Likes