• Lua Tutorial 2 (If you're to lazy to look at GMod Wiki)
    0 replies, posted
[B]Getting Started With Lua[/B] It is recommended you view the [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index2bde.html?title=Lua_Overview"]overview[/URL] page first, for some basic information on lua. This page is mainly about installing a script editor for creating lua scripts. If you have already chosen and installed a script editor, then you should start to read the [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7a06.html?title=Lua_Tutorial_Series"]tutorials[/URL]. [B]Where Do I Start?[/B] First of all, you will need to get a script editor for lua. As lua code is typed in english and not compiled (coverted to computer code) when creating scripts, you only need a simple text editor such as notepad. However, for features such as syntax highlighting (colouring different parts of the code different colours), you will need to install a script editor such as [URL="http://notepad-plus-plus.org/download"]Notepad++[/URL] Or sciTE( [URL="http://opensource.ebswift.com/SciTEInstaller/"][1][/URL] ) Notepad++ is a popular text-editing program within the Lua coding community, due to it being open source and extremly flexible when adding new syntax highlighting. It also allows you to change the colour, formatting style, and font style of the whole text-editor to make it a much more comfortable environment for you to work in. [B] Post-Installation[/B] When you have successfully installed it, and have launched it, you should be greeted by this [IMG]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/images/e/e8/Notepad_01.png[/IMG] First thing you will notice, that if you type any lua syntax, it will not be highlighted, to fix this go to Plugins >> Plugin Manager >> Show Plugin Manager and find the following Syntax Highlighter in the "Available" tab and click 'Install' [IMG]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/images/a/a1/Notepad_02.png[/IMG] This smaller window will be shown during installation [IMG]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/images/2/20/Notepad_03.png[/IMG] After the installation of the Gmod Lua syntax highlighter is complete, you need to go to Settings >> Preferences >> New Document/Default File Directory and set the Default Language to "Gmod Lua", after that, just click close (Making sure Gmod Lua has been selected) [IMG]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/images/e/e9/Notepad_04.png[/IMG] Now you're ready to code [URL="http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8e50.html?title=Your_First_Scripted_Weapon"]Your First Scripted Weapon[/URL].
Sorry, you need to Log In to post a reply to this thread.