• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

When to use lua functions

Ovnyx

Member
Joined
Jul 25, 2017
Messages
163
Solutions
2
Reaction score
7
Hi im returning after some time working hard on my career, actually im retaking my old ot project, and i was curious to know in which cases should i use lua functions instead of adding extra stuff into the source code of the tfs? for example if i want to modify some of the normal behavior of a weapon its a better idea to do it by a lua function? or to add the new features to the tfs source code directly?

thanks in advice!
 
Solution
Work under the following rule:
If it can be done through LUA, do it through LUA. Modify the server code if there's a feature you want to implement which cannot be done through scripting.

LUA is an easier language than C++ if your experience level is the same with both languages. Debugging and correcting errors on LUA scripts is easier as well plus, you don't need to redeploy the server executable with each change.
Work under the following rule:
If it can be done through LUA, do it through LUA. Modify the server code if there's a feature you want to implement which cannot be done through scripting.

LUA is an easier language than C++ if your experience level is the same with both languages. Debugging and correcting errors on LUA scripts is easier as well plus, you don't need to redeploy the server executable with each change.
 
Solution
wow thank you for your replay, so in terms of performance its the same to do lua functions and modify source code?
 
wow thank you for your replay, so in terms of performance its the same to do lua functions and modify source code?

A well-written LUA script should be close to C++'s performance. You shouldn't be able to notice any real difference. That's up to the programmer.
 
Back
Top