DiGiTal Posted December 15, 2017 Share Posted December 15, 2017 (edited) Hello, I'm simple scripter lua mtasa and designer .Enjoy my first tutorial (any question reply it or suggestion, i'll do a list of tutorials )Variables(type):*Global variables: means the variable will be avaible on hole of the script for example: Code: function test() name = 123 jake = "me" end function test() name = 123 jake = "me" end function test1() print(name)--- returns 123 print(jake)------returns me end the ----- it's a advert can't cause anything to the code print it's for to output a string or else. or (because as global variable it can be in the function or out.) Code: name = 123 jake = "me" functio test() ------your code end *Local variables: it will be avaible only on your function attached to. Code: function test() local name = 123 local jake = "me" end and if i do function test() local name = 123 local jake = "me" end function testt() print(jake) ----- return nil end If you saw Code: jake = "me" "me" called a string .*Key words and break do else elseif end false for if in local nil not repeat then return true or until while function *Function : The function is the way that describe your goal by a CODE . it likes Code: function NameOfYourFunction(arguments) -----YOUR CODE end The function end with "end" if you forgot it , your code wrong.*nil : it means nothing*boolean: it return true or false value*if : Is for to state "if" it ends with "end" as for function for ex: local var1=1 local var2=2 function name() if (var1+var2) == 3 then -----do somthing else -----do something else end end means if 2+1 = 3 then insert your code BUT if 2+1 ~= 3 then insert your code (xd)~= means not equal == equal*operators: it's what your learned at school : (+,-,/,*,^) (I'll update it soon) Edited December 15, 2017 by DiGiTal 3 Link to comment
Melbourne Posted December 15, 2017 Share Posted December 15, 2017 It would be good if you indent your codes: local var1=1 local var2=2 function name() if (var1+var2) == 3 then -----do somthing else -----do something else end end function test() local name = 123 local jake = "me" end function testt() print(jake) ----- return nil end It is easier to read. 1 Link to comment
Scripting Moderators thisdp Posted December 15, 2017 Scripting Moderators Share Posted December 15, 2017 Good Job. And don't forget to tell beginners how to deal with errors and warnings. 1 Link to comment
Dimos7 Posted December 15, 2017 Share Posted December 15, 2017 (edited) Nice work Edited December 15, 2017 by Dimos7 1 Link to comment
Recommended Posts