Closed stoneage-mta closed 3 years ago
Did you have to setup vscode-lua in some way to stop warning about mta functions? I remember trying similar tools and it wouldn't stop complaining about mta functions. I have a lot of old code to refactor and this tool would be great. Perhaps you could fork it and add MTA specific features such as spotting deprecated functions etc? I can imagine it would be very popular among scripters.
On the same topic: Dutch showed me this before: https://github.com/Koihik/LuaFormatter and it looks promising perhaps we could configure a standard formating for mtasa resources. Only issues I had with it was that lambda functions would look weird but i think it's configurable. Shall we open a discussion? Maybe it's unecessary but I think it would be worth it.
Did you have to setup vscode-lua in some way to stop warning about mta functions? I remember trying similar tools and it wouldn't stop complaining about mta functions. I have a lot of old code to refactor and this tool would be great. Perhaps you could fork it and add MTA specific features such as spotting deprecated functions etc? I can imagine it would be very popular among scripters.
Hi, you're right, we could fork that project and make it ignore MTA functions by default, but in my case, I just created a dummy .lua file in the same workspace and declared all MTA functions inside it, then the extension will detect that the function has been declared, but since we haven't added this dummy file to meta.xml, the server will still work fine.
Here is the file I was using: mta.zip
This repo still has a lot of that, it would be great if more people could use this technique to help clean it up :)
On the same topic: Dutch showed me this before: https://github.com/Koihik/LuaFormatter and it looks promising perhaps we could configure a standard formating for mtasa resources. Only issues I had with it was that lambda functions would look weird but i think it's configurable. Shall we open a discussion? Maybe it's unecessary but I think it would be worth it.
Maybe we could use https://github.com/multitheftauto/mtasa-resources/issues/250 to discuss this subject
Tested on a high traffic server for over a month, and confirmed to be stable.
This PR replaces deprecated functions, removes unused code, fixes calls to non-existing functions, etc...
I found them using this, and maybe in the near future, i can send other PRs doing the same to other resources.