Need someone who is willing to converse about lua with me.
7 replies, posted
I'm not asking for a mentor, I'm just asking for someone who I can talk to when I'm stuck on lua scripts, and is able to give me tips and such on how I can do things.
I'm pretty sure that there are a couple of you nice enough to do this. Much appreciated if you are!
Spread your lua code out into multiple files, it helps you stay organized.
Have each file be for a specific purpose.
And then just put the addfile commands inside the Initialize lua?
[QUOTE=Crossu88;38184727]And then just put the addfile commands inside the Initialize lua?[/QUOTE]
I think he means to do something like, For example.
If you have a health regeneration script, Instead of splashing it all into HPREGEN.lua
You could splash seperate hooks and functions into.
HPRegen_HurtDelay.lua
HPRegen_Mechanics.lua
HPRegen_Thinking.lua
[QUOTE=Magenta;38187246]I think he means to do something like, For example.
If you have a health regeneration script, Instead of splashing it all into HPREGEN.lua
You could splash seperate hooks and functions into.
HPRegen_HurtDelay.lua
HPRegen_Mechanics.lua
HPRegen_Thinking.lua[/QUOTE]
Okay, that's abit overdone in splitting up into files. Say you're coding a gamemode, instead of handling your highly advanced pooandpee mod inside same file as your scoreboard, split them up.
Always have an open mind about getting something done.
There are always 20 ways to do something but maybe like 5 RIGHT ways.
Give credit to those who help you.
There is a function for just about everything.
That's most I can think of...
- If you have any small questions not worth a thread post here: [url]http://www.facepunch.com/showthread.php?t=1160598[/url]
- If something that someone else has done interests you, pull their scripts up and find out how they did it.
- The wiki/Google/[url=http://glua.me/search/]glua.me[/url] are your best friends when it comes to finding code snippets or proper uses for functions.
- When your code errors, remember how to fix it. Debugging becomes much faster in the future when you know how to quickly identify why your code is causing errors at a glance.
- If you dont have a great memory, make a simple .txt file where you can place useful code snippets and reminders for yourself how to use certain functions, or even just jotting down ideas for different things you have an how you could go about doing them (I often quickly map out scripts before I start them simply because I sometimes get muddled up or forget important details, for example 'player joins > load player data from .txt file > set up timer to save back to file every 60s > save data again on disconnect')
[QUOTE=Donkie;38190455]Okay, that's abit overdone in splitting up into files. Say you're coding a gamemode, instead of handling your highly advanced pooandpee mod inside same file as your scoreboard, split them up.[/QUOTE]
It's an example, I'm not saying you have to split up a VERY small addon into multiple files.
Sorry, you need to Log In to post a reply to this thread.