minified LUA
Is there any issues with only providing the minified version of your LUA source? For example, in my SWAPS addon I am using the minified source. I am interested in knowing if it will conflict with other addons due to variables name changes or if there are any other potential problems.
|
Is there any reason you need to use minified code?
Technically, if you avoid using globals, your minified code should be fine. But you're preventing anyone else from learning from what you do, or helping out. |
I would imagine that it could create a bunch of issues. If there is no reason you need to use minified code, then don't. The only pro that i can think of would be a smaller file size which means it might load 1ms faster (if that). However the list of cons (or potential cons) is much larger.
My suggestion: Don't minify. |
Quote:
The only issue I can think of will be with bug reports as it will be very hard to get any useful information from UI error dialog. A few comments: It is good practice to unregister events you do not need. As you are trying to make your code very small, you can register for EVENT_ADD_ON_LOADED as follows: Lua Code:
Also to keep minimal length of code, you do not need to define names for your controls: Lua Code:
You are using: Lua Code:
|
But for all of this, why minify anything?
People aren't downloading the lua on the fly, the length of your variable names aren't going to affect load by any significant amount. None of the -benefits- of minification apply here, unless you consider obfuscation a benefit, and coming from a point of addon coding, where everyone should be able to read the code, that's not a benefit. |
Quote:
My addon Unified Chat Tabs v 1.0 measures 35,4 KiB decompressed (including embedded libraries) and 12 KiB .zip compressed. Notice that I wrote KiB. Of wich 1024 make just a measily MiB. Of wich 1024 make just a measily GiB. Are there even still HDD below 500 GiB on the market? In turn: You will have a hell to debug this. Since you propably also do not use comments, you will have a hell to udnerstand your own code after 6 months (and those are real life figures I ran into when I forgot to comment). Nobody can learn from your code Nobody can help you debug your code if you are stumped. Good ability to debug and follow your own code is a at least 1,048,576 times more important then sqeezing out the last byte of filesize on something that will propably not even fill a 4 KiB cluster in the first place. |
Quote:
Im new to LUA and addons so I am sure there is a better way to optimize my code. I didnt minify to optimize space, load, or variable length. Just to protect the source somewhat. |
Quote:
if you do have even a single randomized global in there I (and probably many others) am/are going to curse you :D ... because it 's like playing russian roulette with other addons. You never know whom or what you hit. till you hit it. So please dont ever do that. :D Cheers |
Quote:
Yeah I think I am going to just post the source code and deal with it. I have a lot of really cool ideas and features I want to add to this. I am depending on the forums a lot for support when I am stuck. Its really difficult learning LUA and the ESO api at the same time. Im kind of shocked I made this in a week so far alone. I learn best from examples. The wiki is useful but I have a hard time understanding how to apply a lot of things. The next version will be w/o minify |
Quote:
Wouldn't refuse to help anyway. Cheers! :) |
Quote:
Yeah, it is frustrating when copying happens (there's a thread about it somewhere on these forums), but as long as you spot a copy or someone else shows it to you, this site's wonderful moderators will give you all the assistance you need. |
At least you can work with UI mate, I am a noob when it comes to UI stuff... if this was Torchlight II however, I'd be able to make UI-origami if the words fit to each other right!
Back to the topic, if you are (were) mainly using minify for performance gains, I don't think this game/API would benefit from it that much. General rules of LUA apply though; like locals being accessed faster than globals (even a simple local next = next improves just a tad), it is best to avoid nested if-checks if possible, etc... general programming stuff if you think about it, not just LUA. As ingeniousclown said, if anyone tries to copy your stuff over here, moderators seem to be very responsive and helpful. I'm glad that you decided to ignore minify for the future, I'm very curious to see the code as a "whole", like you, I best learn with examples and I think I will learn quite a bit from your work :) |
The top ESO lua coding addon tip I can offer is
Download and learn how to use Zgoo |
All times are GMT -6. The time now is 07:40 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI