lua_openscript

I am trying to test scripts using the “lua_openscript” command in console and tested it with a simple line “print (“Hello World”)”
And I get this https://gyazo.com/742d4ca4ed1bb5963fd9f415ce37636b

Don’t know what to do.

At the top of your code add AddCSLuaFile(), glad I could help.

So like this :

AddCSLuaFile()
print (“Hello World”)

Yes

lua_openscript test.lua
Running script test.lua…
Couldn’t include file ‘test.lua’ (File not found) (<nowhere>)

Restart your game, even though you shouldn’t need to. For some reason it’s not working.

Still says the same thing

lua_openscript is for server files, if your file is client-sided, use lua_openscript_cl

(or put it in lua/autorun)

Personally i like to create things i make as an addon, saves me from wasting time in console commands and it keeps everything in one folder.

Create a folder in addons, then create a lua folder and make a folder named autorun in that lua folder.
Put your script in there and it will automatically say Hello world.

You only need to do AddCSLuaFile on a server where a client needs a lua file,(A hud for example)

I have no idea why you’re having problems.

I created an identical file, only content is:
[lua]print(“Hello World”)[/lua]
Result:

Also pictured: lua_openscript has completion based on the files and folders that exist there (just like changelevel has with maps). If you don’t see your file being suggested, then for some reason the game can’t see it. If you DO see it being completed but still get the error… Well, that usually means that the file is empty (I think), but in your case it clearly isn’t. I’m stumped.