Will there be shorthand assignment/counter operators?

I notice I have to write "pos.x = pos.x + 1" instead of "pos.x += 1". Will there be these shorthand expressions at some point in the future?

Also sorry if I couldn’t see anything online or if there’s preferences to change in Defold, but also why does it remove the indent in a line of code when I press enter?

--|--| indent
--|    pressed enter
--|--| -cursor here
--|--|

image
I press enter so I can add the end.

image
now instead of pressing arrow key up and writing code with proper indentation, I start writing right there.
image

I suppose that has me fooled, thinking I will have to manually correct the indentation. but once I complete the function with the brackets, it corrects itself.
image

If I set my own variable, it will correct itself when I press enter.
image

image

I just feel it makes things difficult for me as I don’t think it should remove an indent automatically.

You can use Visual Studio Code for writing scripts in instead of the editor. Search the forum for how.

I notice I have to write "pos.x = pos.x + 1" instead of "pos.x += 1". Will there be these shorthand expressions at some point in the future?

No, because it’s not a part of Lua. You can search any search engine for why Lua doesn’t have shorthand assignment, there are a few reasons for it.

2 Likes

Thanks. I just found there’s the ability to use an external IDE. I will try for that.

Do you know any extensions that would help with getting set up with lua code in visual studio code? I found something on the manual but doesn’t seem to be working visually.

https://forum.defold.com/search?q=visual%20studio%20code

Post in the thread related to the tool you are using? I don’t know which one you’re trying to use.

2 Likes

This should be the most up to date vscode integration as far as I know: Guide how to turn VSCode into Defold IDE with debugger

3 Likes

Sorry for the late reply. I think I got it mostly working. But I decided to try working with the default IDE for now. I’ll send screenshots for what I’m using.

Edit: Here I found some information Writing code
and followed the link Defold API Snippets - Visual Studio Marketplace which directed me to this extension.

1 Like