1/7/2024 0 Comments Garrys mod e2 codesThe foreach loop is used for elements with a string index in a table, whereas the for loop is for elements with a numerical index. What it allows you to do is iterate over every element of a table of a given type. This loop has a similar idea to the for loop, however, it is made to iterate specifically over tables. You can also use it to act upon a table if the table's elements are indexed by a number, but not if they are indexed by a string. ![]() The for loop is generally used for acting upon part or all of an array, as arrays have elements indexed by a number. Hint("We're on iteration "+((Cookie+1)/2),7) #Create a hint that says what iteration we're on, not the value of Cookie. The editor will auto-indent new lines that follow a syntax) is as follows:įor(Cookie = 1, 11, 2) #Start on 1, go until 11, increase by 2 each time. To delete an indent from a section, use Ctrl + Shift + I. To indent a section of code, use Ctrl + I. I would advise you to keep your code well indented and not to write more than one action per line. Let me begin by clarifying the syntax I will use and some of the basic concepts of Expression 2. Feel free to link to this tutorial on other websites as long as you don't claim credit for it.If you see any errors in the examples, please reply to the thread or PM me.Look at the first two sections if you are new to E2, then look at the sections that interest you. The sections aren't really in order of difficulty.If you do not understand a section, reply here and I'll try to clarify on it. ![]() The examples given here are purposefully basic to give you an idea of how the functions work so you then use your imagination to apply them.Any code with a # before it is a comment and is not executed with the exception of #ifdef, #else, #endif and #include.Wiremod Wiki page containing all major functions included with Wiremod and their usage: Last updated: - Added data management section. ![]() If there's anything in particular you'd like me to write a tutorial for let me know and I'll see what I can do. Seeing as a few people on the server seem keen to learn E2, I'll link a few useful resources.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |