When you are about to save the Lua code into Lua folder,
and you have VVindows Vista, using normal Notepad, it gives you the choice of encoding you want to use
The first time I saved, I saved with ANSI encoding. When I tried to use console to play the file (I'm new, I am following the newb tutorial by making the Hello World thing.) So what other encoding am I meant to use?
- ANSI
- Unicode
- Unicode big endian
- UTF-8
Which of these 4?
ANSI. Any other encoding will result in an unusable script.
Oh, if thats true...
Now the problem is my code, it is simply
Msg("Hello World!")
I write
lua_openscript helloworld.lua
in console to activate it, but it doesn't work, is it a typing error?
P.S. It is saved as helloworld.lua in my Garrysmod/lua/ folder, along with the three other folders entitled
includes
postprocess
vgui
Its saved as "All Files"
[editline]08:37PM[/editline]
-bump-
Are you on a server you aren't the host of?
No, I test the Codes in singleplayer.
[b]hello.lua[/b]
[code]
Msg( "Hello world!" )
[/code]
[code] lua_openscript hello.lua
Running script hello.lua...
Hello world![/code]
Save in ANSI, and it works. I think it might be something on your end. You sure you don't have it saved as hello.lua.txt or something of the like?
Wait, I need a space between ( and " before Hello world! ?
[QUOTE=Loriborn;19115504]Wait, I need a space between ( and " before Hello world! ?[/QUOTE]
No, that's just a way you can format it for readability. You don't [b]need[/b] it.
Is there a space between Msg and ( "Hello World!" )
[QUOTE=Loriborn;19115669]Is there a space between Msg and ( "Hello World!" )[/QUOTE]
Same as above - you can put it there if you want to, but it isn't needed.
You could do this if you wanted to: [code]Msg ( "hi" )[/code]
So then whats my issue? I have it saved to
Program Files/Steam/Steamapps/<Steamname>/garrysmod/garrysmod/lua/
it looks like ->
Name Date modified Type Size
[]] includes
[]] postprocess
[]] vgui
[]] helloworld.lua
Are there any errors in the console, or there is just no output?
It says its a Nil value, or something like that
[editline]09:58PM[/editline]
Oh wait, Got it, I was typing in Msg not msg, or at least I think thats what I changed to fix it.
Sorry, you need to Log In to post a reply to this thread.