This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Half-Life: Alyx Workshop Tools/Lua Scripting/Getting Started

From Valve Developer Community
< Half-Life: Alyx Workshop Tools‎ | Lua Scripting
Revision as of 11:58, 22 May 2020 by McNutty (talk | contribs) (Created page with "{{HLATools topicons}} == What is Lua? == {{HLATools topicons}} Lua is a programming language frequently used in games running on the source engine. Lua scripts are able to ta...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

What is Lua?

Lua is a programming language frequently used in games running on the source engine. Lua scripts are able to talk to the game engine through an API layer, which allows people to create new scripts for weapons, gammemodes and much more.

  • NOTE: Due to Half Life Alyx being a fairly new game, some of the API functionality simply does not exist yet on the engine side. For example, you may encounter some API calls that will simply return nil instead of what you were expecting.

What to do first

1. Find your hlvr folder

  • The path should looks something like: D:\SteamLibrary\steamapps\common\Half-Life Alyx\game\hlvr, depending on where you installed it.

2. Create folders

  • Create a folder called: scripts. Inside that folder create another folder called: vscripts.
  • you should now be in a directory that looks like this: D:\SteamLibrary\steamapps\common\Half-Life Alyx\game\hlvr\scripts\vscripts

This is where all your .lua files will go

Source looks for the scripts in the scripts/vscripts folder. You can also add folders in scripts/vscripts to separate out your scripts by project or have common scripts.

Starter Examples

These basic examples will show you how to connect the game world to the scripts that you write:

1. link to HelloGordon

2. Coming soon ...