Need Help With Starting Lua

Alright. As you can tell by the title I’m not being so successful. I looked at the guide which looked pretty straight forward and such, but I have been having some problems. Here it is:

It tells me to open up “Notepad” and to write out:

Msg(“Hello World!”)

I do this. And I save my file to the: STEAM>STEAMAPPS>“MYUSERNAME”>GARRYSMOD>GARRYSMOD>LUA folder.

When I open up Garrys Mod and type:

“lua_openscript helloworld.lua”

it says:

Couldn’t include file ‘helloworld.lua’ (File not found)

Please help!

Are you sure you have saved the file as a .lua? Make sure your operating system allows you to see the file extensions.

Also I recommend you get both Notepad ++ and luapad to help you test code.

Okay I think this is where I might be going wrong.

I look at my " " " Garrysmod>Lua> and I see two things at the bottom"

One is a LUA file and the other is a text document.

My “Hello World!” is the text document… is it supposed to be like that?

As Crazy Quebec said, you need to save it as a .lua file. You’ve managed to save it as a .txt file because viewing extensions isn’t turned on.
Here’s how you enable viewing file extensions:
If you’re using Vista

Or this if you’re using Windows 7

Or if you’d by any chance be using Windows XP

Okay great! Thanks!

Okay so the file is now turned into a lua file. But when I try and:

lua_openscript helloworld.lua

It says this:

Running script helloworld.lua…
helloworld.lua:1: unexpected symbol near '['

When I wrote the script in notepad this is exactly what I put.

Msg(“Hello World!”)

Just without the “*****” before the “Lua”.



You shouldn’t wrap the code in Lua tags. Remove the [noparse][lua][/lua][/noparse].

Your not supposed to have lua tags around your lua code in that way…



You don’t put the [noparse][lua][/lua][/noparse] tags inside the script.


So do I just type:

Msg(“Hello World!”) ?




:ninja: retaliation.

Alright thanks guys. : )

And it works!! Thanks alot guys.

If you’re wanting to create Lua files easily, try downloading Notepad++ and downloading the Gmod Lua Lexer plugin from the built-in Plugin Manager

When I head to the google website for the downloads of the Gmod Plugins, there are four

downloads. Which one do I download?

Hang on, I will give you the link to both.

Notepad++ :
Plugin :


That should help.

Also, if you ever need to check something, check the wiki first to see how it works, before asking on here.

If only you did this

Why are you telling that to me? You have plenty of questions on here that are answered by the wiki.

He’s talking about me :stuck_out_tongue: