Getting Started with Lua

  • Project Developer


    As many of you know, Pluto uses a powerful scripting language called Lua. Because many Pluto users are used to InfinityScript, I'm creating this basic tutorial to assist users in using Lua. The information in this tutorial will help you get started. The tutorial does NOT represent a full-fledged documentation of the Lua API, nor does it teach you everything about Lua.

    Although our full API docs are not available, I recommend referring to ZeRoY's docs for the time being. Please note these docs are not specifically for IW5, so some information will be inaccurate.

    An example lua script is attached to this post with some basic functionality, and some examples of the features listed below. Feel free to modify the script to suit your needs.


    • Installation of PlutoIW5 over a CLEAN copy of Call of Duty: Modern Warfare 3. Follow this to get a clean IW5 install.
    • Get familiar with Lua's syntax and features through Lua's documentation page.
    • Basic text editor to write scripts. (i.e. Notepad++)


    • Make sure that your game directory has a scripts folder: i.e. X:\Call of Duty Modern Warfare 3\scripts\mp. This is where dedicated server scripts will be loaded from.
    • Scripts are conventionally named with a .lua extension i.e HelloWorld.lua
    • Scripts can be loaded/unloaded by typing loadScript HelloWorld.lua/unloadScript HelloWorld.lua respectively in the server console. Include these lines in your server.cfg to automatically load these scripts.


    If an argument is named tblArgs, then it refers to a Lua table. Refer to the official Lua documentation for more information about tables.

    • playerDamage(tblArgs)
    • tblArgs.ent
    • tblArgs.inflictor
    • tblArgs.attacker
    • tblArgs.damage
    • tblArgs.mod
    • tblArgs.weapon
    • tblArgs.point
    • tblArgs.dir
    • tblArgs.hitloc
    • playerKilled(tblArgs)
    • tblArgs.ent
    • tblArgs.inflictor
    • tblArgs.attacker
    • tblArgs.damage
    • tblArgs.mod
    • tblArgs.weapon
    • tblArgs.dir
    • tblArgs.hitloc
    • localCommand(args)
    • preGameInit()
    • postGameInit()
    • afterDelay
    • onInterval
    • notify
    • levelNotify
    • frame

    Examples included in test script.

    GSC Functions

    There are two types of GSC functions: ScriptMethods and ScriptFunctions.


    • Called on GameObjects i.e. Entity

    Usage: player:getguid()


    • These functions are "global," and not called on object instances.

    Usage: gsc.iPrintLnBold("hello " ..


    • chatPrint(string)
    • getPlayers()
    • print(string)
    • executeCommand(string) - only on dedi

    Usage: util.chatPrint("hello world")

    If there are specific lua functions that you want to see, then mention them in this thread. They may be included in an updated version of the sample script.

    Download the script HERE (updated link on Nov. 12, 2017)

    Check out the admin script created by @RektInator HERE

  • Can you upload a file with all functions and arguments pasted? No need description.
    Can i link various source files and only load one with loadScript? like using #include directive

  • How would I go on about making a script to control damage of certain guns?

  • onPlayerSay doesnt work.

    Your example with commands doesnt work either

  • @Junx maybe they disable it, was working on first release. Just wait till they fix the bugs.

  • This post is deleted!

  • This post is deleted!

  • could you put the list of gsc functions?

  • so when will the first half of the script actually work?

  • Project Admin

    This post is deleted!

  • Project Admin

    @fallen-sea When we re-enable it server side in an upcoming update.

  • Cool Cool, good to know.

  • This post is deleted!

  • How to stop a callback? example stop onInterval on the change next map

  • VIP

    @luffynando I guess you could declare a variable outside of the callback, change the variable from somewhere else, and let the interval callback check if said variable is false or not before running the rest of it's code.
    It'd be better if there was some kind of way to 'unsubscribe' from a callback but for now this works I guess.

  • @thedutchman yeah, i implemented a flag for check but no it´s best solution, because the callback is still running even if it does not execute the code, I guess that spends memory

  • Project Developer

    The download link has been updated. A new script with a broader range of functionality will be released in the coming weeks.

Log in to reply

Looks like your connection to Plutonium Project was lost, please wait while we try to reconnect.