Reduce Lag Caused by Multiple Lua Scripts menu

Shout-Out

User Tag List

Results 1 to 3 of 3
  1. #1
    darkwiz787's Avatar Member
    Reputation
    35
    Join Date
    Mar 2009
    Posts
    250
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reduce Lag Caused by Multiple Lua Scripts

    What?
    If you have ever had a server running lot's of scripts, you may have noticed poor performance coming from your Lua Engine. Well, there's a solution.

    Why?
    Well, when you create a variable you actually just make a new key in the _G table. If you don't know about Tables, go here. Therefore,

    Code:
    my_var = 1
    is the same as
    Code:
    _G["my_var"] = 1

    It does the same for functions. Every function you create is stored on _G. That's pretty much everything.

    Imagine, trying to remember everyone in a High School's locker combination. Now imagine you had someone remembering the combo for every locker. A lot easier for you, eh?
    Yes, I'm Canadian.

    Great..? Now How do I Fix This?

    Simple. We have to store everything on separate tables. This is easy for Variables, as we showed before. It's just as easy, if not easier for Functions! Simple put the Table name before the function name, and put a period in between them:

    Code:
    var = 0
    function doSomething(Unit, Event, Player)
    var = 5
    end
    Should be

    Code:
    someTable = {}
    
    function someTable.doSomething(Unit, Event, Player)
    someTable["var"] = 5
    end

    Reduce Lag Caused by Multiple Lua Scripts
  2. #2
    demerda's Avatar Banned
    Reputation
    10
    Join Date
    Aug 2007
    Posts
    200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Old, but gold.

    Thanks

  3. #3
    Eldrak's Avatar Corporal
    Reputation
    1
    Join Date
    Jan 2010
    Posts
    16
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    People really should be using this more often.

Similar Threads

  1. [Guide] Lua Scripting Guide is here [Updating]
    By Illidan1 in forum WoW EMU Guides & Tutorials
    Replies: 93
    Last Post: 11-04-2008, 06:56 PM
  2. Lua Scripts!
    By danis in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 12-15-2007, 03:16 PM
  3. How To LUA Script
    By Skuxta in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 12-13-2007, 04:24 AM
  4. New LUA Scripts
    By 777devil777 in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 11-26-2007, 05:58 PM
  5. Will This speed yp my server and reduce lag?
    By mafiaboy in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 11-01-2007, 05:01 PM
All times are GMT -5. The time now is 12:58 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search