Forum

> > CS2D > Scripts > LUA scripts do lag?
Forums overviewCS2D overview Scripts overviewLog in to reply

English LUA scripts do lag?

13 replies
To the start Previous 1 Next To the start

old LUA scripts do lag?

maPmaKer
User Off Offline

Quote
Hello,

I've been asking this to myself from the first time I have learnt to use LUA scripts on servers and now I am asking you the same.

Is it possible that, if a LUA scipt is composed from more LUA scripts, to overload the server and create lag?

Thank you,
maPmaKer

old Re: LUA scripts do lag?

SQ
Moderator Off Offline

Quote
It depends on how many "parse" commands lua is executing.
So yeah, Lua scripts can, indeed, slow down the server and cause the lag.
edited 1×, last 14.07.11 01:23:06 pm

old Re: LUA scripts do lag?

Alistaire
User Off Offline

Quote
If they trigger eachother constantly it should lag like hell.
I once started a server with bots, and used a script which showed a custom shoot image when a bot attacked. Well.. that was what it has to do. It showed an image every time the bot moved, so my fps went down to 1 and the server crashed.

old Re: LUA scripts do lag?

DannyDeth
User Off Offline

Quote
No, Lua is not that* system-heavy, but on a low-powered server overly large scripts will start to create minor lags ( however, you must note that the same script will probably cause a stack-overflow error before it lags your server ). Also, the script would need to be doing a lot of heavy workouts - like sorting long lists, scanning/comparing multiple tables together, etc. I used Lua the other day to write a database, and it didn't lag at all. ( it was only like 200 lines long, but it was sorting lists that had several thousand entires at a time ( this was temporary, as I was waiting for MySQL to download and it said it had like 9 hours to go [ I know, really slow internet connection... ] ).

old Re: LUA scripts do lag?

DannyDeth
User Off Offline

Quote
@2Fast4You:
It is probably network stress ( because of all the image() function calls and things like that ), no decent computer should lag running Lua scripts.

old Re: LUA scripts do lag?

maPmaKer
User Off Offline

Quote
user DannyDeth has written
@map:
How many scripts are you running?


On my town server , which has the biggest script, are running 5 LUA scripts combined into one.

old Re: LUA scripts do lag?

DannyDeth
User Off Offline

Quote
What sort of scripts are they? Could I find them in the File Archive? It might not be lag caused by the Lua scripts, but the traffic created by the Lua scripts which is in turn creating lag.

old Re: LUA scripts do lag?

maPmaKer
User Off Offline

Quote
user DannyDeth has written
What sort of scripts are they? Could I find them in the File Archive? It might not be lag caused by the Lua scripts, but the traffic created by the Lua scripts which is in turn creating lag.


1. Money script
2. Weapon stripping gate
3. Admin color
4. Automatic round restarter
5. Advertising LUA

You can find them everywhere. But I was just asking. My VPS isn't so good too, so that might be the cause.

old Re: LUA scripts do lag?

DC
Admin Off Offline

Quote
it really depends on the script(s), the server (available CPU power/RAM), the network condition and the number of players on the server.

script which are executed frequently (like each frame) can quickly slow down the game and lead to lags. especially if they are using commands which cause additional network traffic.
same for very complex scripts.

each command which shows something on the clientside (like all image and text commands) cause additional network traffic!

good scripts are designed in a way that they don't cause lag.
some scripters don't really care about that and write bad scripts which can easily cause lag. be aware of that.

old Re: LUA scripts do lag?

Apache uwu
User Off Offline

Quote
Yeah there are 2 types of lag, server and client sided lag.


Server Sided:
>You have excessive commands on parse, or hook_always()
>You load a lot of files or output a lot of files

Client Sided:
>Lots of buildings
>Lots of images
>Lots of NPCs
>Lots of chat messages

Just make sure your lua scripts run normally and it doesn't past like 3000 lines. lool
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview