{"id":10365,"date":"2022-08-22T06:40:53","date_gmt":"2022-08-22T06:40:53","guid":{"rendered":"https:\/\/brightchamps.com\/blog\/?page_id=10365"},"modified":"2024-12-03T12:35:52","modified_gmt":"2024-12-03T12:35:52","slug":"lua-programming-language","status":"publish","type":"page","link":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/","title":{"rendered":"Lua Programming Language: Guide to Lua Coding for Kids"},"content":{"rendered":"\n[et_pb_section fb_built=&#8221;1&#8243; fullwidth=&#8221;on&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;Page Title Section&#8221; _builder_version=&#8221;4.18.0&#8243; use_background_color_gradient=&#8221;on&#8221; background_color_gradient_direction=&#8221;100deg&#8221; background_color_gradient_stops=&#8221;#6b73ff 0%|#000dff 100%&#8221; background_color_gradient_start=&#8221;#6b73ff&#8221; background_color_gradient_end=&#8221;#000dff&#8221; background_image=&#8221;https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2022\/08\/Lua-Programming-Language-Guide-Image.png&#8221; custom_padding=&#8221;100px||100px|&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row admin_label=&#8221;Page Title Area&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; module_alignment=&#8221;left&#8221; module_alignment_tablet=&#8221;left&#8221; module_alignment_phone=&#8221;center&#8221; module_alignment_last_edited=&#8221;on|phone&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text admin_label=&#8221;Title&#8221; _builder_version=&#8221;4.17.4&#8243; text_font=&#8221;Poppins||||||||&#8221; text_font_size=&#8221;18px&#8221; text_line_height=&#8221;1.8em&#8221; header_font=&#8221;Poppins|600|||||||&#8221; header_text_align=&#8221;left&#8221; header_font_size=&#8221;40px&#8221; header_line_height=&#8221;1.4em&#8221; header_2_font=&#8221;||||||||&#8221; background_layout=&#8221;dark&#8221; max_width=&#8221;700px&#8221; module_alignment=&#8221;center&#8221; global_colors_info=&#8221;{}&#8221;]<h1>Lua Programming Language: Lua Coding Tutorial for Kids<\/h1>\n<p>Learn Lua Coding fast with this beginner&#8217;s guide.\u00a0\u00a0<\/p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row admin_label=&#8221;Page Title Area&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; module_alignment=&#8221;center&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_button button_url=&#8221;https:\/\/learn.brightchamps.com\/book-trial-class?utm_source-blog_organic&#038;utm_medium=blog&#038;utm_campaign=codechamps&#8221; url_new_window=&#8221;on&#8221; button_text=&#8221;Get Started&#8221; button_alignment=&#8221;left&#8221; _builder_version=&#8221;4.21.0&#8243; _module_preset=&#8221;default&#8221; custom_button=&#8221;on&#8221; button_text_size=&#8221;20px&#8221; button_text_color=&#8221;#000000&#8243; button_bg_color=&#8221;#ffd90f&#8221; button_border_width=&#8221;0px&#8221; button_border_radius=&#8221;10px&#8221; button_font=&#8221;Poppins|300|||||||&#8221; button_use_icon=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_button][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16.1&#8243; _module_preset=&#8221;default&#8221; custom_padding=&#8221;27px|||||&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row column_structure=&#8221;3_4,1_4&#8243; module_id=&#8221;minecraft&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; custom_margin=&#8221;8px|auto||auto||&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;3_4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_text module_id=&#8221;lua&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;42px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Introduction to Lua Programming<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p><span style=\"font-weight: 400;\">As a language for extending software applications, <a href=\"https:\/\/www.lua.org\/\"><strong>Lua<\/strong><\/a> was initially created in 1993 to meet the rising demand for customization at the time. It offers the fundamental programming features found in most procedural programming languages, but it does not include more complex or domain-specific features. Instead, it includes mechanisms for language extension that enable programmers to add these features.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Although the inventors of Lua worked on enhancing its speed, portability, extensibility, and ease of use in development to make it better, Lua programming is designed to be a broad embeddable extension language.<\/span><\/p>[\/et_pb_text][et_pb_video src=&#8221;https:\/\/youtu.be\/jUuqBZwwkQw&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_video][et_pb_text module_id=&#8221;lua&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;42px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; global_colors_info=&#8221;{}&#8221;]<h2>What is Lua?<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; custom_padding=&#8221;||0px|||&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Lua is an open-source language and it has its value across multiple platforms ranging from large server systems to small mobile applications.<\/p>\n<p><span style=\"font-weight: 400;\">Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes developed the extensible, lightweight Lua programming language as an internal project in 1993. It is implemented in C.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It was designed from the beginning to be software that <\/span><span style=\"font-weight: 400;\">could<\/span><span style=\"font-weight: 400;\"> be integrated with the code written in C and also with other conventional languages.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Lua is cross-platform because its C API is reasonably straightforward and its interpreter for compiled bytecode is built in ANSI C.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This connection offers many advantages. Lua has a safe environment, automatic memory management, and a good facility for handling strings and other types of data with dynamic size because it aims to provide what C is not good at, such as a good distance from the hardware, dynamic structures, no redundancies, and ease of testing and debugging.<\/span><\/p>\n<p class=\"p1\"><span style=\"font-weight: 400;\">In <\/span><span style=\"font-weight: 400;\">Roblox, <\/span><span style=\"font-weight: 400;\">the coding language used is<\/span><span style=\"font-weight: 400;\"> Lua,<\/span><span style=\"font-weight: 400;\"> and it is the easiest coding language to learn. When we are used <\/span><span style=\"font-weight: 400;\">to<\/span><span style=\"font-weight: 400;\"> Roblox <\/span><span style=\"font-weight: 400;\">Studio, the<\/span><span style=\"font-weight: 400;\"> code runs fast.<\/span><\/p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2022\/02\/Free-Kids-Coding-Resources-scaled.jpg&#8221; alt=&#8221;Kids using Computer&#8221; title_text=&#8221;Kids using Computer&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; width=&#8221;70%&#8221; border_radii=&#8221;on|10px|10px|10px|10px&#8221; border_width_all=&#8221;1px&#8221; border_color_all=&#8221;#777777&#8243; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;42px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Lua Programming Usage<\/h2>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p><strong>In Game Development<\/strong><\/p>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">As it is widely used by many game developers for popular games, some of them are mentioned below<\/p>\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><\/span>Roblox<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>SimCity 4<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Warframe<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>World of Warcraft<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>CRYENGINE<\/li>\n<\/ul>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p><strong>Used by Top Global Companies<\/strong><\/p>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Some of the companies that are using Lua are:<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<ul class=\"ul1\">\n<li class=\"li2\"><span class=\"s1\"><\/span>Shopify<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Thumbtack<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Close<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Unacademy<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Kong<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Tokopedia, etc.<\/li>\n<\/ul>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;42px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Features of the Lua Language<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Lua provides some of the unique features that make it distinct from any other language. Here are some of them mention below:<\/p>\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><\/span>Extensible<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Simple<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Efficient<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Portable<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Free and open<\/li>\n<\/ul>\n<ul class=\"ul1\"><\/ul>[\/et_pb_text][et_pb_code _builder_version=&#8221;4.16.1&#8243; _module_preset=&#8221;default&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;][et_bloom_inline optin_id=&#8221;optin_4&#8243;][\/et_pb_code][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;42px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Application of the Lua Language<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Some of the real life application of Lua programming language are:<\/p>\n<ul class=\"ul1\">\n<li class=\"li2\"><span class=\"s1\"><\/span>Game Programming<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Scripting in Standalone Applications<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Scripting on the Web<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>Extensions and also its add-ons for databases like MySQL Proxy and MySQL Work Bench<\/li>\n<li class=\"li2\"><span class=\"s1\"><\/span>It has a Security system like Intrusion Detection System.<\/li>\n<\/ul>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p><strong>Advantages of the Lua Language<\/strong><\/p>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><\/span>It has very efficient memory usage.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It has an open-source license.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is very easy to insert into the C programming language.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is very good scripting for games.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is very simple to use and to learn.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>The syntax is pretty good and easy.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is flexible so that it can be extended as needed.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It fits different problem types.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is a first-class function.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is a garbage collection.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is a closure, proper tail calls.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is coercion, it means automatic conversion between string and number values at run time.<span class=\"Apple-converted-space\">\u00a0<\/span><\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is a coroutine, which means cooperative multitasking.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is a dynamic module load.<\/li>\n<\/ul>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p><strong>Few Drawbacks of the Lua Language<\/strong><\/p>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><\/span>Some of its codes need to be coded manually.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It is a new language and it has a small community of users or clients.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It makes mistakes when we declare any variables.<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>It doesn\u2019t support the general-purpose exception handling.<\/li>\n<\/ul>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Creating a Script in Roblox Studio<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Creating a script is very easy.<span class=\"s1\"> <\/span>Scripts can be inserted almost everywhere. Move over to the Model on the top panel and search to the far left. Click on the Script, which will generate a script that we can use for our coding. It is case-sensitive.<\/p>\n<p class=\"p1\">Here are some of the concepts explained.<\/p>\n<p class=\"p1\"><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Comments in the Lua Language<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">A comment in Lua coding is the text that is completely ignored by the compiler or the parser. Comments are generally added by the scriptwriter or the programmer to explain or annotate the code that is written. They are added to make the source code easier to read and understand for humans.<\/p>\n<p class=\"p1\">To make a <b>short comment, <\/b>we have to start with a double hyphen (&#8211;) anywhere outside a string and it extends to the end of the line in code.<\/p>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p1\"><em><span class=\"s1\">&#8212; This is a comment<\/span><\/em><\/p>\n<p class=\"p1\"><em><span class=\"s1\">local var = 44 &#8212; This is a comment for the following code on the same line<\/span><\/em><\/p>\n<\/blockquote>\n<p class=\"p1\">Comments for multi-line or several lines can also be defined using a long format that is enclosed by the brackets.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p2\"><em>&#8211;[[<\/em><\/p>\n<p class=\"p2\"><em>This is a multi-line comment.<\/em><\/p>\n<p class=\"p2\"><em>And it can also contain short comment hyphens<\/em><\/p>\n<p class=\"p1\"><em><span class=\"s1\">]]<\/span><\/em><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Print Function in Lua Coding<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Print is called the heart and soul of coding. Print is a built-in function that helps us to print out whatever statement we want to display on the console. It can be either numbers or strings and we can see that once we launch a script, there is already a print function automatically typed and present in it. We will erase it to continue with the next step.<\/p>\n<p class=\"p1\">Type the word <b>print<\/b> in all lowercase letters. In some cases, if the print is typed incorrectly or typed with any capital letter, the program will not recognize the command and will not run it because it is <b>case sensitive<\/b>.<\/p>\n<p class=\"p1\"><span style=\"font-weight: 400;\">If you add two round parentheses, the studio should automatically add the second one when you finish adding the first. However, there must be no space between the print and the parenthesis for the Lua to be able to read and understand it.<\/span><\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\"><b>For example:<\/b><\/span><\/p>\n<blockquote>\n<p class=\"p1\"><em><span class=\"s1\">print()<\/span><\/em><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Strings in Lua Programming<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Strings are used to hold the text of our code. They are bracketed or covered by apostrophes or quotation marks. in the print () function, we need to add a string in-between the parenthesis so that we don\u2019t just print space.<\/p>\n<p class=\"p1\">We can also use a pair of single quotes (\u2019\u2019) or a double parenthesis (\u201c \u201d). A string is nothing but any character or words inside of a pair of quotes, such as<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<blockquote>\n<p class=\"p1\"><em><span class=\"s1\">print(&#8220;BrightChamps&#8221;)<\/span><\/em><\/p>\n<\/blockquote>\n<p class=\"p1\">we can also replace it with any other text that we want it is in-between the parenthesis (&#8220;).<\/p>\n<p class=\"p1\"><b>Expected output:<\/b><\/p>\n<blockquote>\n<p class=\"p1\"><em><span class=\"s1\">BrightChamps<\/span><\/em><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_code _builder_version=&#8221;4.16.1&#8243; _module_preset=&#8221;default&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;][et_bloom_inline optin_id=&#8221;optin_4&#8243;][\/et_pb_code][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Variables in Lua<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\"><span style=\"font-weight: 400;\">A variable is a container or memory region with a name and the ability to store a value. Any data type, including numbers, texts, Booleans, and many others, can be used as a variable&#8217;s value.<\/span><\/p>\n<p class=\"p1\"><b style=\"font-size: 20px;\">Naming Variables in Lua<\/b><\/p>\n<p class=\"p4\">The rules in Lua variable naming are is mentioned below<\/p>\n<ul class=\"ul1\">\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s2\"><\/span>The variable name can be of any non-reserved string of letters<\/li>\n<li class=\"li1\"><span class=\"s3\"><\/span>The variable name can have a digits<\/li>\n<li class=\"li1\"><span class=\"s3\"><\/span>The variable name cannot start with a digits<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span>The variable name cannot have a space in between<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span>The variable name cannot be a keyword<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span>The variable names are case sensitive<span class=\"Apple-converted-space\">\u00a0<\/span><\/li>\n<li class=\"li1\"><span class=\"s3\"><\/span>The variable name can have underscores as a special character<\/li>\n<\/ul>\n<\/ul>\n<p class=\"p5\"><span style=\"text-decoration: underline;\">Examples<span class=\"s4\"><span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/span><\/p>\n<blockquote>\n<p class=\"p6\">LETTEr <span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0 <\/span>&#8212; valid<\/p>\n<p class=\"p6\">a12<span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0 \u00a0 <span class=\"Apple-tab-span\"> <\/span><\/span>&#8212; valid<\/p>\n<p class=\"p6\">var_1name<span class=\"Apple-converted-space\">\u00a0 <span class=\"Apple-tab-span\"> <\/span><\/span>&#8212; valid<\/p>\n<p class=\"p6\">_2test <span class=\"Apple-converted-space\">\u00a0 \u00a0 <span class=\"Apple-tab-span\"> <\/span><\/span>&#8212; valid<\/p>\n<p class=\"p6\">Var12name<span class=\"Apple-converted-space\">\u00a0 <\/span>&#8212; valid<\/p>\n<p class=\"p6\">else <span class=\"Apple-converted-space\">\u00a0 \u00a0<span class=\"Apple-tab-span\"> <\/span><span class=\"Apple-tab-span\"> <\/span> <\/span>&#8212; NOT valid<\/p>\n<p class=\"p8\"><span class=\"s5\">5th <span class=\"Apple-converted-space\">\u00a0 \u00a0 \u00a0<span class=\"Apple-tab-span\"> <\/span> <\/span>&#8212; NOT valid<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">As Lua programming language is case-sensitive the variable name TestVar and TESTVAR are two unique names.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p1\"><em><b>NOTE<\/b>: The names that begin with an underscore followed by the uppercase letters should be avoided, as they may be reserved for internal global Lua variables.<\/em><\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<p class=\"p1\"><em><span class=\"s5\">_VERSIONs<\/span><\/em><\/p>\n<p class=\"p1\">Some of the <b>Reserved Names<\/b> in Lua are as follows and cannot be used as variable or function names: and, for, or, break, function, repeat, do, if, return, else, in, then, else if, local, true, end, nil, until, false, not, while.<\/p>\n<p><span class=\"s1\"><\/span><b>Variable Assignment<\/b><\/p>\n<p class=\"p2\">Assigning a value to a variable is done with the help of the assignment operator that is = the operator. The variable is always on the left-hand side of the = operator and while the value is always on the right-hand side.<\/p>\n<blockquote>\n<p class=\"p3\">x = 4<\/p>\n<p>&nbsp;<\/p>\n<p class=\"p3\">word = &#8220;Hi&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p class=\"p3\">reference = workspace.Part<\/p>\n<p>&nbsp;<\/p>\n<p class=\"p3\">print(x)<\/p>\n<p>&nbsp;<\/p>\n<p class=\"p3\">print(word)<\/p>\n<p>&nbsp;<\/p>\n<p class=\"p2\"><span class=\"s2\">print(reference<\/span>)<\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">4<\/p>\n<p class=\"p3\">Hi<\/p>\n<p class=\"p2\"><span class=\"s2\">Part<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">Once we have declared a variable value later it can be changed by simply assigning another value to it as shown below:<\/p>\n<blockquote>\n<p class=\"p3\">x = 550<\/p>\n<p class=\"p3\">print(x)<\/p>\n<p class=\"p3\">x = 5542<\/p>\n<p class=\"p2\"><span class=\"s2\">print(x)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Expected output:<\/em><\/p>\n<blockquote>\n<p class=\"p3\">550<\/p>\n<p class=\"p2\"><span class=\"s2\">5542<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">Lua also allows us to set or change multiple variables in the same command just by separating each variable-value pair with a comma as shown below:<\/p>\n<blockquote>\n<p class=\"p3\">a, b, c = 4,5,6<\/p>\n<p class=\"p3\">print(a)<\/p>\n<p class=\"p3\">print(b)<\/p>\n<p class=\"p2\"><span class=\"s2\">print(c)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Expected output:<\/em><\/p>\n<blockquote>\n<p class=\"p3\">4<\/p>\n<p class=\"p3\">5<\/p>\n<p class=\"p3\">6<\/p>\n<p class=\"p3\"><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p><strong>\u00a0 Variable Scope<\/strong><\/p>\n<p class=\"p2\">In Lua, variables exist in two possible scopes, that is a global and a local variable scope. All variables with the default scope will be global unless it is declared as local.<\/p>\n<ul>\n<li class=\"p3\">Global Variable Scope<\/li>\n<\/ul>\n<p class=\"p2\">A global variable is visible to all the scopes of a script or the coding.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<blockquote>\n<p class=\"p4\">x = 1 &#8212; Global variable &#8220;x&#8221;<\/p>\n<p class=\"p4\">for i = 1, 5 do<\/p>\n<p class=\"p4\"><span class=\"Apple-tab-span\"> <\/span>x = x + 1<\/p>\n<p class=\"p4\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;Global &#8216;x&#8217; = &#8221; .. x)<\/p>\n<p class=\"p4\">end<\/p>\n<p class=\"p2\"><span class=\"s2\">print(&#8220;Global &#8216;x&#8217; = &#8221; .. x)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\"><em>Expected output:<\/em><\/span><\/p>\n<blockquote>\n<p class=\"p4\">Global &#8216;x&#8217; = 2<\/p>\n<p class=\"p4\">Global &#8216;x&#8217; = 3<\/p>\n<p class=\"p4\">Global &#8216;x&#8217; = 4<\/p>\n<p class=\"p4\">Global &#8216;x&#8217; = 5<\/p>\n<p class=\"p2\"><span class=\"s2\">Global &#8216;x&#8217; = 6<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span class=\"s2\"><\/span><\/p>\n<ul>\n<li class=\"p1\">Local Variable Scope<\/li>\n<\/ul>\n<p class=\"p2\"><span style=\"font-weight: 400;\">Only the block where it was declared can access or use a local variable. Because they are incorporated into the same environment in which they were formed, local variables are quicker than global variables.<\/span><\/p>\n<p class=\"p2\">We should always use local variables over global variables unless we don\u2019t have a specific reason. Local variables are declared using the local keyword as shown below:<\/p>\n<p class=\"p3\">local x = 110<span class=\"Apple-converted-space\">\u00a0 <\/span>&#8212; Local variable &#8220;x&#8221;<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\"><b>For example:<\/b><\/span><\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s1\">local x = 445<span class=\"Apple-converted-space\">\u00a0 <\/span>&#8212; Local variable &#8220;x&#8221;<\/span><\/p>\n<p class=\"p3\">for i = 1, 5 do<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>local x = 5<span class=\"Apple-converted-space\">\u00a0 <\/span>&#8212; Different variable &#8220;x&#8221;, local to this &#8220;for&#8221; loop<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;Loop &#8216;x&#8217; = &#8221; .. x)<\/p>\n<p class=\"p3\">end<\/p>\n<p class=\"p2\"><span class=\"s1\">print(&#8220;Initial &#8216;x&#8217; = &#8221; .. x)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\"><b>Expected output:<\/b><\/span><\/p>\n<blockquote>\n<p class=\"p3\">Loop &#8216;x&#8217; = 5<\/p>\n<p class=\"p3\">Loop &#8216;x&#8217; = 5<\/p>\n<p class=\"p3\">Loop &#8216;x&#8217; =5<\/p>\n<p class=\"p3\">Loop &#8216;x&#8217; = 5<\/p>\n<p class=\"p3\">Loop &#8216;x&#8217; = 5<\/p>\n<p class=\"p2\"><span class=\"s1\">Initial &#8216;x&#8217; = 445<\/span><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Operators in Lua Programming Language<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">The Print function also works for numbers and equations, then it will automatically simplify the output. But before we write our program, we have to find the symbols that need to get the right answer.<\/p>\n<p class=\"p1\">So here are A<b>rithmetic Operators.<\/b><\/p>\n<p class=\"p1\"><b>Arithmetic operators<\/b> are all the tools that we use in our program to indicate a relationship between numbers. These are what we call the symbols that we use to add, subtract, multiply, and also divide the numbers.<\/p>\n<p class=\"p1\">Some of the Arithmetic Operators that we used in Lua are:<\/p>\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><\/span>Addition: +<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Subtraction: &#8211;<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Multiplication: *<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Division: \/<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Exponents: ^<\/li>\n<li class=\"li1\"><span class=\"s1\"><\/span>Modulus: % (used to find the reminder)<\/li>\n<\/ul>\n<p class=\"p1\">In print, we will write our equation in-between the round parenthesis.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p1\"><b>For example:<\/b><\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s2\">print(5 + 5 * 11^2 \/ 10 &#8211; 20)<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">Lua uses the math rules for the Order of Operations. It means, it starts with exponents, division, multiplication, and finally addition and subtraction.<\/p>\n<p class=\"p1\"><b>For example,<\/b><\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s2\">print(2 + 5 * 3)<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">by looking at the above equation we say the answer is 21, since you add 2 + 5, get 7 and, multiply by 3, this is wrong. Instead of that, we have to multiply 5 and 3 first, then add 2, getting 21. So, this is a rule of both math and programming.<\/p>\n<ul><\/ul>[\/et_pb_text][et_pb_video src=&#8221;https:\/\/youtu.be\/mBvigusegkg&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_video][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Tables in Lua Language<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Tables are used for storing a very large set of data. A table is a Lua that includes the data type to store values like numbers, Booleans, strings, functions, and many more. We can access and manipulate the data easily.<\/p>\n<p class=\"p1\">These are more lists that contain the indexes of objects, arrays, and more. To indicate the tables, we use the curly braces {} as shown here:<\/p>\n<blockquote>\n<p class=\"p2\">local p = {}<\/p>\n<p class=\"p1\"><span class=\"s1\">print(p)<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s1\">table: 0035AE18<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">Once the table is been created it behaves as either an array or a dictionary. This concept we are going to learn is below.<\/p>\n<h3><span class=\"s1\"><\/span><b>Lua Arrays<\/b><\/h3>\n<p class=\"p2\">Arrays are simply a list of order values that are compiled in a table. This can include strings, numbers, Booleans, functions, and so on.<\/p>\n<p class=\"p2\">To make an array, we have to start by assigning a name to it of our own choice. it is useful for storing collections of data such as a group of players with special permissions.<\/p>\n<ul>\n<li class=\"p1\"><b>Creating Arrays<\/b><\/li>\n<\/ul>\n<p class=\"p2\">To<span style=\"font-weight: 400;\">\u00a0successively store the data, with commas separating them, in a Lua table to build an array. Any non-nil type, including Boolean, number, string, function, user data, or another table, can be a value for an array.<\/span><\/p>\n<p class=\"p2\">To assign a table to the data by adding an \u201c=\u201d in between, and write a pair of curly brackets.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s2\">local randArray = {}<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">Then we place all of the values inside the array. We can add more variety to our table but we have to make sure to separate each value by adding commas in-between them.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s2\">local randArray = {&#8220;Brightchamps&#8221;, 10, &#8220;welcome to the brightchamps&#8221;, 17}<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">Lua scripting uses 1-based indexing for arrays so each value in the array has an index or number that is assigned to it. For example, the first value is 1, the second value is 2, the third value is 3, and so on.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\"><span class=\"Apple-converted-space\"><\/span><\/p>\n<ul>\n<li class=\"p1\"><b>Reading an element from Arrays<\/b><\/li>\n<\/ul>\n<p class=\"p2\">To print a specific part of the array, we have to write the table name in the print function and then the index of the value, the in-between square brackets [].<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local randArray = {&#8220;Brightchamps&#8221;, 10.1, &#8220;welcome to the brightchamps&#8221;, 17}<\/p>\n<p class=\"p2\"><span class=\"s1\">print(randArray[1])<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">the output will be the first string:<\/p>\n<blockquote>\n<p class=\"p2\">\u201c<span class=\"s1\">Brightchamps\u201d.<\/span><span class=\"s1\"><\/span><\/p>\n<\/blockquote>\n<ul>\n<li class=\"p1\"><b>Writing Into Arrays<\/b><\/li>\n<\/ul>\n<p class=\"p2\">The value of an array and its index can be redefined or rewritten by making use of the index number in the brackets ([pos]) that is followed by the = operator and then specifying the value.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local randArray = {&#8220;Brightchamps&#8221;, 10.1, &#8220;welcome to the brightchamps&#8221;, 17}<\/p>\n<p class=\"p3\">randArray [2] = 12345<\/p>\n<p class=\"p3\">randArray [4] = &#8220;New string&#8221;<\/p>\n<p class=\"p3\">print(randArray [2])<\/p>\n<p class=\"p2\"><span class=\"s1\">print(randArray [4])<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">12345<\/p>\n<p class=\"p2\"><span class=\"s1\">New string<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span class=\"s1\"><b>Inserting Items <\/b><\/span>at the end of an array using the methods or the function so the LUA uses the table.insert() function to add elements or values into the array.<\/p>\n<p class=\"p1\">To Add the new item into the array using this syntax <em>t[#t+1].<\/em><\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p2\">local randArray = {&#8220;Brightchamps&#8221;, 10.1, &#8220;welcome to the brightchamps&#8221;, 17}<\/p>\n<p class=\"p2\">table.insert(randArray, &#8220;New string&#8221;)<\/p>\n<p class=\"p2\">randArray [#randArray +1] = &#8220;Another new string&#8221;<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\">print(randArray [5])<\/p>\n<p class=\"p1\"><span class=\"s2\">print(randArray [6])<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p2\">New string<\/p>\n<p class=\"p1\"><span class=\"s2\">Another new string<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">If we want to insert an item in between the start and the end by specifying the position value as a second argument of the table.insert() function.<\/p>\n<p class=\"p1\">So this will insert the new item and push the item that is present with one index position ahead.<\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p2\">local randArray = {&#8220;Brightchamps&#8221;, 10.1, &#8220;welcome to the brightchamps&#8221;, 17}<\/p>\n<p class=\"p2\">table.insert(randArray, 2, &#8220;NEW ITEM #2&#8221;)<\/p>\n<p class=\"p2\">print(randArray [1])<\/p>\n<p class=\"p2\">print(randArray [2])<\/p>\n<p class=\"p1\"><span class=\"s2\">print(randArray [3])<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p2\">Brightchamps<\/p>\n<p class=\"p2\">NEW ITEM #2<\/p>\n<p class=\"p1\"><span class=\"s2\">10.1<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span class=\"s2\"><\/span><\/p>\n<ul>\n<li class=\"p1\"><b>Iterating Over an Arrays<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Arrays can be iterated over or looped through in the following two ways:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul class=\"ol1\">\n<li class=\"li2\">By making use of the built-in <em>ipairs()<\/em> function for a loop.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p class=\"p3\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p4\">local TArray = {&#8220;this is a string&#8221;, 3.9, workspace.part, &#8220;New string here&#8221;}<\/p>\n<p class=\"p4\">for i, value in ipairs(TArray) do<\/p>\n<p class=\"p4\"><span class=\"Apple-tab-span\"> <\/span>print(i, value)<\/p>\n<p class=\"p3\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p3\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p4\">this is a string<\/p>\n<p class=\"p4\">3.9<\/p>\n<p class=\"p4\">workspace.part<\/p>\n<p class=\"p3\"><span class=\"s1\">New string here<\/span><\/p>\n<\/blockquote>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul class=\"ol1\">\n<li class=\"li2\">By Getting the array length using the # operator and looping it from 1 to that length of the array.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p class=\"p3\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p4\">for ii = 1, #testArray do<\/p>\n<p class=\"p4\"><span class=\"Apple-tab-span\"> <\/span>print(ii, TArray[index])<\/p>\n<p class=\"p3\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p3\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p4\">this is a string<\/p>\n<p class=\"p4\">3.9<\/p>\n<p class=\"p4\">workspace.part<\/p>\n<p class=\"p3\"><span class=\"s1\">New string here<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><b>Removing Items from Arrays in Lua<\/b><\/p>\n<p class=\"p2\">If we want to remove an item from the array so the LUA provides a function called a <em>table.remove(). <\/em><\/p>\n<p class=\"p2\">This function will help us to remove the item at the specified position and move an item down one index position.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local randArray = {&#8220;Brightchamps&#8221;, 10.1, &#8220;welcome to the brightchamps&#8221;, 17}<\/p>\n<p class=\"p2\">table.remove(<span class=\"s1\">randArray<\/span>, 2)<\/p>\n<p class=\"p2\">print(<span class=\"s1\">randArray<\/span> [1])<\/p>\n<p class=\"p2\">print(<span class=\"s1\">randArray<\/span> [2])<\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">Brightchamps<\/p>\n<p class=\"p2\"><span class=\"s1\">Welcome to the brightchamps<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span class=\"s1\"><\/span><\/p>\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s1\"><\/span><b>Dictionaries<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Dictionaries are the extension of an array. As we know the array stores an ordered list of items, and a dictionary stores a value set of key-value pairs.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Key<span class=\"Apple-tab-span\"> <\/span><span class=\"Apple-tab-span\"> <\/span>Value<\/span><\/p>\n<blockquote>\n<p class=\"p2\">FruitName<span class=\"Apple-tab-span\"> <\/span>mango<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\">FruitColor<span class=\"Apple-tab-span\"> <\/span>yellow<\/p>\n<p class=\"p2\">Sour<span class=\"Apple-tab-span\"> <\/span><span class=\"Apple-tab-span\"> <\/span>false<\/p>\n<\/blockquote>\n<ul>\n<li class=\"p1\"><b>How to Create Dictionaries<\/b><\/li>\n<\/ul>\n<p class=\"p2\">To create a dictionary, we have to keep remember that each key is followed by = and then the value we have to write, and each key-value pair is separated with a comma.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local testD = {<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitName = &#8220;mango&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitColor = &#8220;yellow&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>Sour = false<\/p>\n<p class=\"p2\"><span class=\"s2\">}<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">The keys are not limited to string names but a key also may be an Instance, so the key must be declared by surrounded by the brackets ([key])<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local p = Instance.new(&#8220;Part&#8221;)<\/p>\n<p class=\"p3\">local testD = {<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>PType = &#8220;Block&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>[p] = true<\/p>\n<p class=\"p2\"><span class=\"s2\">}<\/span><\/p>\n<\/blockquote>\n<ul>\n<li class=\"p1\"><b>Reading From the Dictionaries<\/b><\/li>\n<\/ul>\n<p class=\"p2\">To read it from a dictionary, add a pair of brackets after it specifies the reference and then specifies the key name.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local p = Instance.new(&#8220;Part&#8221;)<\/p>\n<p class=\"p3\">local testD = {<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>PType = &#8220;Block&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>[p] = true<\/p>\n<p class=\"p3\">}<\/p>\n<p class=\"p3\">print(testD[&#8220;PType&#8221;])<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">print(testD[p]) <span class=\"Apple-converted-space\">\u00a0<\/span><\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">Block<\/p>\n<p class=\"p2\"><span class=\"s1\">true<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">The String keys like <em>PType<\/em> must be surrounded with the quotes as in <em>testD[&#8220;PType&#8221;]<\/em>. Non-string keys like <em>[p]<\/em> should not be surrounded by quotes.<\/p>\n<ul>\n<li class=\"p1\"><b>Writing Into the Dictionaries<\/b><\/li>\n<\/ul>\n<p class=\"p2\">The value of a new or the existing dictionary key can be defined by indicating the key name in the square brackets [key] that should be followed by = and then the value in it.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local testD = {<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitName = &#8220;mango&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>Sour = false<\/p>\n<p class=\"p3\">}<\/p>\n<p class=\"p3\">testD [&#8220;FruitName&#8221;] = &#8220;Banana&#8221;<\/p>\n<p class=\"p3\">testD [&#8220;Sour&#8221;] = false<\/p>\n<p class=\"p3\">testD [&#8220;FruitCount&#8221;] = 20<\/p>\n<p class=\"p3\">print(testD [&#8220;FruitName&#8221;])<\/p>\n<p class=\"p3\">print(testD [&#8220;Sour&#8221;])<\/p>\n<p class=\"p2\"><span class=\"s1\">print(testD [&#8220;FruitCount&#8221;])<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">Banana<\/p>\n<p class=\"p3\">False<\/p>\n<p class=\"p2\"><span class=\"s1\">20<\/span><\/p>\n<\/blockquote>\n<ul>\n<li class=\"p1\"><b>Iterating Over the Dictionaries<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Dictionaries can be iterated or read over with the help of the built-in pairs() function in a for a loop.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local testD = {<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitName = &#8220;mango&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitColor = &#8220;yellow&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>Sour = false<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p3\">}<\/p>\n<p class=\"p3\">for key, values in pairs(testD) do<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(key, values)<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">FruitNamemango<\/p>\n<p class=\"p3\">FruitColoryellow<\/p>\n<p class=\"p3\">Sourfalse<\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Note: using the ipairs() function in the array, dictionary iteration happens via the pairs() does not necessarily return items in the same order as it is mentioned in the dictionary.<\/em><\/p>\n<ul>\n<li class=\"p1\"><b>Removing Key-Value Pairs<\/b><\/li>\n<\/ul>\n<p class=\"p2\">To remove a key-value pair from the dictionary, we have to set its value to nil. The following example completely erases the key-value pair from the dictionary.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local testD = {<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitName = &#8220;mango&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>FruitColor = &#8220;yellow&#8221;,<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>Sour = false<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p3\">}<\/p>\n<p class=\"p3\">testD [&#8220;Sour&#8221;] = nil<\/p>\n<p class=\"p3\">for key, value in pairs(testD) do<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(key, value)<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">FruitName mango<\/p>\n<p class=\"p2\"><span class=\"s1\">FruitColor yellow<\/span><\/p>\n<\/blockquote>\n<ul>\n<li class=\"p1\"><b>Tables as References<\/b><\/li>\n<\/ul>\n<p class=\"p2\">If we have stored a table in a new variable, at that time copy of that table is not created but the variable becomes a reference that is a pointer to the original table or a variable.<\/p>\n<p class=\"p2\">It means any changes to the original table will be reflected in the references.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local originalA = {10, 20}<\/p>\n<p class=\"p3\">local arrayR = originalArray<\/p>\n<p class=\"p3\">print(&#8220;Original values:&#8221;, originalA[1], originalA[2])<\/p>\n<p class=\"p3\">print(&#8220;Reference values:&#8221;, arrayR[1], arrayR[2])<\/p>\n<p class=\"p3\">originalA[1] = 1000<\/p>\n<p class=\"p3\">originalA[2] = 2000<\/p>\n<p class=\"p2\"><span class=\"s1\">print(&#8220;Reference values:&#8221;, arrayR [1], arrayR[2])<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">Original values: 10 20<\/p>\n<p class=\"p3\">Reference values: 10 20<\/p>\n<p class=\"p2\"><span class=\"s1\">Reference values: 1000 2000<\/span><\/p>\n<p><span class=\"s2\"><\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span class=\"s2\"><\/span><\/p>[\/et_pb_text][et_pb_video src=&#8221;https:\/\/youtu.be\/-5Vma8aNCkA&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_video][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Concatenation in Lua Scripting<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p2\">To combine two or more separate values, we use concatenation in the print function. We can use the same format as adding two numbers but we have to add two periods or the dots after each string.<\/p>\n<p class=\"p2\">We should not place the dot inside the string or else the Lua will think it is a part of the string and it sometimes produces an error.<\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s1\">print(&#8220;It is around&#8221;.. &#8221; 3: 44 PM&#8221;)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">The output will show us a full statement as if it is a single string, meaning the concatenation is successful.<\/p>\n<p class=\"p2\">So, the <b>output<\/b> will look like something that is shown below:<\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s1\">It is around 3: 44 PM<\/span><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Loops in Lua Programming<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p2\">Loops are the statements that allow us to execute the code or repeat code multiple times. In Lua coding, each loop repeats a block of code but in different ways.<\/p>\n<p class=\"p3\"><\/p>[\/et_pb_text][et_pb_video src=&#8221;https:\/\/youtu.be\/gi4DCaBpsnw&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_video][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>While Loop in Lua Script<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p2\">While loops repeat the sequences of code while the condition is true. If the condition is false, it will not execute the block of code and it ends. If the condition is true, the code between the do and end executes and the true\/false condition is checked again.<\/p>\n<p class=\"p2\">The while loop can also be a <b>countless or infinite<\/b> loop. The condition evaluates to be true or false that is Boolean value.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local x = 1<\/p>\n<p class=\"p3\">while x &lt; 5 do<\/p>\n<p class=\"p3\"><span class=\"Apple-converted-space\">\u00a0\u00a0 \u00a0 <\/span>print(&#8220;The value is less than 5&#8221;)<\/p>\n<p class=\"p3\"><span class=\"Apple-converted-space\">\u00a0\u00a0 \u00a0 <\/span>x = x + 1<\/p>\n<p class=\"p3\">end<\/p>\n<p class=\"p2\"><span class=\"s2\">print(&#8220;The value is not less than 5&#8221;)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p2\"><span class=\"s2\">The value is less than 5<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">The while loop is an infinite loop by using a true as the condition:<\/p>\n<blockquote>\n<p class=\"p3\">while true do<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;Looping in the process&#8230;&#8221;)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>wait(0.5)<\/p>\n<p class=\"p2\"><span class=\"s2\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">A <em>wait()<\/em> function is used to delay inside an infinite loop<\/p>\n<p class=\"p3\"><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>For Loop in Lua<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p><span style=\"font-weight: 400;\">The for loop executes a command or collection of commands a predetermined number of times. A control variable, a start value, an end value, and an optional increment value will all be present in it. Up until the provided end value is reached, the loop will keep repeating.<\/span><\/p>\n<p class=\"p2\">The starting value increases by 1 by default, we can also change it by adding a comma after the end value.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\"><b>The Syntax:<\/b><\/span><\/p>\n<blockquote>\n<p class=\"p4\">for (VariableName) = (Start Value), (End Value), (Number of values increases by optional)<\/p>\n<p class=\"p5\"><span class=\"s2\"><span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>(Statements)<\/span><\/p>\n<p class=\"p5\"><span class=\"s2\">End<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">for count = 1, 5, 2 do<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(count)<\/p>\n<p class=\"p2\"><span class=\"s2\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">1<\/p>\n<p class=\"p3\">3<\/p>\n<p class=\"p2\"><span class=\"s2\">5<\/span><\/p>\n<\/blockquote>\n<p class=\"p3\"><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Repeat\/Until Loop in Lua<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p2\">A repeat loop repeats until a certain condition is met or done. The code between repeat and until is executed at least once because the conditional test is performed afterward as it is a post-conditional loop.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local x = 1<\/p>\n<p class=\"p3\">repeat<\/p>\n<p class=\"p3\"><span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>print(&#8220;The value is less than 5&#8221;)<\/p>\n<p class=\"p3\"><span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>x = x + 1<\/p>\n<p class=\"p3\">until(x &gt; 5)<\/p>\n<p class=\"p2\"><span class=\"s2\">print(&#8220;The value is greater or equal to 5&#8221;)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p3\">The value is less than 5<\/p>\n<p class=\"p2\"><span class=\"s2\">The value is greater or equal to 5<\/span><\/p>\n<\/blockquote>\n<p class=\"p3\"><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Break<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p><span style=\"font-size: 20px;\">If we are having a loop that is infinite while true do loop then we can force it to end with the help of the break command. If we are writing break at the end of a loop then it will end the loop if a condition is true. <\/span><\/p>\n<p><span style=\"font-size: 20px;\">We can also use this in a nested loop. A nested loop is a loop with another loop inside of it.<\/span><\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local a = 0<\/p>\n<p class=\"p3\">local timout = 5<\/p>\n<p class=\"p3\">while true do<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;Looping&#8230;.&#8221;)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>wait(0.1)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>a = a + 1<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>if a == timout then<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span><span class=\"Apple-tab-span\"> <\/span>break<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>end<\/p>\n<p class=\"p3\">end<\/p>\n<p class=\"p2\"><span class=\"s2\">print(&#8220;Loop ended so moving on!&#8221;)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">Looping&#8230;.<\/p>\n<p class=\"p3\">Looping&#8230;.<\/p>\n<p class=\"p3\">Looping&#8230;.<\/p>\n<p class=\"p3\">Looping&#8230;.<\/p>\n<p class=\"p3\">Looping&#8230;.<\/p>\n<p class=\"p3\">Looping&#8230;.<\/p>\n<p class=\"p3\">Loop ended so moving on!<\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Functions in Lua<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">When we are writing a sequence of code that needs to be repeated in a different place, it may be a little difficult to write it several times. Functions in Lua are a set of instructions that can be used multiple times in a script and they can be repeated and manipulated a lot easier. A function can be called or executed through a command or triggered through an event.<\/p>\n<p class=\"p1\">There are <b>built-in functions<\/b> of Lua, such as print.<\/p>\n<ul>\n<li class=\"p2\"><b>Creating\/ Defining a Functions<\/b><\/li>\n<\/ul>\n<p class=\"p1\">A basic function declaration includes the function keyword and then assigns it a name by following the rules then adding a pair of parentheses () after the function name without any spacing in-between, and then pressing enter from the keyboard.<\/p>\n<p class=\"p1\">The function body will be a block of code, so it must be closed with the end keyword or close off your function or else Lua will give us an error.<\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum()<\/p>\n<p class=\"p1\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">The commands will be executed which is inside the block when the function is called.<\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum ()<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>&#8212; this is a Function body<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;inside the Function when it is called!&#8221;)<\/p>\n<p class=\"p1\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">Now we have our function but still, we don\u2019t get any output because we have not called our function yet to execute.<span class=\"Apple-converted-space\">\u00a0<\/span><span class=\"Apple-converted-space\"><\/span><\/p>\n<ul>\n<li class=\"p1\"><b>Calling a Function<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Once a function is defined or created then it should be executed by calling it but the functions do not self-execute so.<\/p>\n<p class=\"p2\">To execute or call a function we need to type the function name on the next line, and Lua will print the strings that are in the function.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum ()<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>&#8212; this is a Function body<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;inside the Function when it is called!&#8221;)<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">addNum ()<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s1\">inside the Function when it is called!<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Note: if we are using the variables have to be defined before the functions get executed or else it will give us nil.<span class=\"Apple-converted-space\">\u00a0<\/span><\/em><\/p>\n<p class=\"p2\" style=\"padding-left: 40px;\"><\/p>\n<blockquote><\/blockquote>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<ul>\n<li class=\"p1\"><b>Local Variables and Code Blocks<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Local variable scope is much more limited as explained above but the global variables can be accessed anywhere in our script or the code after being defined, whereas the local variables are limited to a block.<\/p>\n<p class=\"p2\">What is a <b>code block<\/b>? The sequence of code that is inside our function.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum ()<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>&#8212; this is a Function body<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>local myVar =\u201dwelcome to the brightchamps\u201d<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(myVar)<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;inside the Function when it is called!&#8221;)<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">addNum ()<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p2\"><span class=\"s1\">welcome to the brightchamps<\/span><\/p>\n<p class=\"p2\"><span class=\"s1\">inside the Function when it is called!<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Note: If we try to print the local variable outside the function block, we are going to get the nil since the variable can\u2019t be accessed outside.<\/em><\/p>\n<ul>\n<li class=\"p1\"><b>Function Arguments and Parameters<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Whenever we execute a function, we might want to change certain parts of the code every time. So, the Parameters are used to tell Lua which variables inside the function we want to change.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\">Here we can manipulate the variables of the functions with ease. The pair of parentheses we have when creating a function or when we are calling a function that we used to put arguments and parameters.<\/p>\n<p class=\"p2\"><span style=\"font-weight: 400;\">Functions may allow us to send in data as parameters. We can place one or more parameter names inside parentheses after declaring a function.<\/span><\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum (n1, n2)<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">When we are calling a function with parameters, we should specify that the values should be passed to the function. An argument is a value that we assign the code to it when it is executing. It comes inside our next pair of parentheses and then we can be changed it every time we execute the function separately as shown below.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\"><em>Note: Arguments and the parameters are not limited to a single pair we can have as many as we want but make sure each argument and parameter are separated by a comma.<\/em><\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum (n1, n2)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>local result = n1 + n2<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(\u201cSo the result is\u201d..n1 .. &#8221; + &#8221; .. n2 .. &#8221; = &#8221; .. result)<\/p>\n<p class=\"p3\">end<\/p>\n<p class=\"p3\">addNum(7, 3)<\/p>\n<p class=\"p3\">addNum(5, 0.5)<\/p>\n<p class=\"p2\"><span class=\"s1\">addNum(100, 5000)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">So the result is 7 + 3 = 10<\/p>\n<p class=\"p3\">So the result is 5 + 0.5 = 5.5<\/p>\n<p class=\"p2\"><span class=\"s1\">So the result is 100 + 5000 = 5100<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Note:<span class=\"Apple-converted-space\">\u00a0 <\/span>The arguments and the parameters should be in the same order or else it will assign the wrong value to the variable.<\/em><span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p class=\"p2\">Function with the parameters is always local to the function and it is used only inside the function&#8217;s scope and also its descending scopes.<\/p>\n<p class=\"p2\"><em>Note: In the Lua function, if we are passing more parameters than it&#8217;s expecting, the excess ones will be ignored and if the function expects more parameters than we have provided, the value nil will be passed or used for all missing parameters.\u00a0<\/em><\/p>\n<ul>\n<li><b>Returning a Value<\/b><\/li>\n<\/ul>\n<p class=\"p2\">Here the functions can also return or send back the data to the calling function or command by making use of the <b>return<\/b> keyword.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum(n1, n2)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>local r = n1 + n2<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>return r<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><em>Note: we should not put any commands after a return command or else it will give us an error.<\/em><\/p>\n<p class=\"p2\">When a function returns then it should be assigned to a variable or used it.<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum(n1, n2)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>local r = n1 + n2<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>return r<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<p class=\"p3\">&#8212; a function calling<\/p>\n<p class=\"p3\">local result1 = addNum (2, 3)<\/p>\n<p class=\"p3\">print(result1)<\/p>\n<p class=\"p3\">local result2 = addNum(1000, 1000)<\/p>\n<p class=\"p2\"><span class=\"s1\">print(result2)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">5<\/p>\n<p class=\"p2\"><span class=\"s1\">2000<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\">Here the Lua even lets us return multiple values from a function:<\/p>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">local function addNum(n1, n2)<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>local sum = n1 + n2<\/p>\n<p class=\"p4\">local diff = n1 &#8211; n2<\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>return sum, diff<\/p>\n<p class=\"p2\"><span class=\"s1\">end<\/span><\/p>\n<p class=\"p3\">local sum, difference = addNum (2, 3)<\/p>\n<p class=\"p3\">print(sum)<\/p>\n<p class=\"p2\"><span class=\"s1\">print(difference)<\/span><\/p>\n<\/blockquote>\n<p class=\"p2\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">5<\/p>\n<p class=\"p2\"><span class=\"s1\">-1<\/span><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_video src=&#8221;https:\/\/youtu.be\/mTKf4MiTqw4&#8243; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_video][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Properties in Lua<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\"><span style=\"font-weight: 400;\">If we want to modify any workspace object&#8217;s settings, such as transparency or invisibility, we must lay down the specifics so that Lua is aware of our intentions.<\/span><\/p>\n<p class=\"p1\">Sometimes if we want to change the transparency of any part or object, we need to define that the part is inside the game.<\/p>\n<p class=\"p1\">Workspace, with the game that we are working on and workspace being the place where the part is and the rest of our parts are stored. Then, we have to write the object or a part name that we want to change (part) and the setting or the property that we want to change like its transparency, and then assign a value that we wish to.<\/p>\n<p class=\"p1\">If we want it to be fully invisible then set the value to 1, 0 will be visible.<\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s1\">game.WorkSpace.part.Transparency = 1<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"font-weight: 400;\">If we run the code or play the game, the output will be the portion that is entirely invisible.<\/span><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Booleans in Lua<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\"><span style=\"font-weight: 400;\">Only two values make up the Boolean. Booleans are based on conditions that either give you true or false in scripting. A Boolean value will be generated when the values are compared.<\/span><\/p>\n<p class=\"p1\"><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>Relational Operators<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; ul_line_height=&#8221;1.6em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">The Relational operators are the operators that we used to compare values with one another values.<\/p>\n<p class=\"p1\">The following are some of the relational operators:<\/p>\n<ul class=\"ul1\">\n<li class=\"li1\"><span class=\"s2\"><\/span><b>Equal to<\/b> this is used to compare two values: ==<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span><b>Not equal to<\/b>, it gives us true if the values are not equal: ~=<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span><b>Greater than<\/b>: &gt;<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span><b>Less than<\/b>: &lt;<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span><b>Greater than or equal to<\/b> &gt;=<\/li>\n<li class=\"li1\"><span class=\"s2\"><\/span><b>Less than or equal to<\/b> &lt;=<\/li>\n<\/ul>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">5 &gt; 4<\/p>\n<p class=\"p3\">12 == 12<\/p>\n<p class=\"p1\"><span class=\"s3\">8 &lt; 3<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">Output:<\/span><\/p>\n<blockquote>\n<p class=\"p3\">True<\/p>\n<p class=\"p3\">True<\/p>\n<p class=\"p1\"><span class=\"s3\">False<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><em>Note: Never get confused with the equal =, this is used to assign something and == is used to compare two values.<\/em><\/p>\n<p class=\"p1\"><\/p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; header_3_font_size=&#8221;26px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h3><strong>If Statements in Lua<\/strong><\/h3>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">If the statement is a decision-making statement that makes sure some specific commands only happen if the condition is true then it will execute the code.<\/p>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">For Example<\/span><\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s3\">if 110&gt; 22 then<\/span><\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;Welcome to the Brightchamps&#8221;)<\/p>\n<p class=\"p1\"><span class=\"s3\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s3\">Welcome to the Brightchamps<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\">Another way to say true instead of the above method so that it prints the string.<\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s3\">if true then<\/span><\/p>\n<p class=\"p3\"><span class=\"Apple-tab-span\"> <\/span>print(&#8220;Welcome to the Brightchamps &#8220;)<\/p>\n<p class=\"p1\"><span class=\"s3\">end<\/span><\/p>\n<\/blockquote>\n<p class=\"p1\"><span style=\"text-decoration: underline;\">Expected Output:<\/span><\/p>\n<blockquote>\n<p class=\"p1\"><span class=\"s3\">Welcome to the Brightchamps<\/span><\/p>\n<\/blockquote>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Lua Local Scripts<\/h2>[\/et_pb_text][et_pb_text module_id=&#8221;test&#8221; _builder_version=&#8221;4.21.0&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Lato||||||||&#8221; text_text_color=&#8221;#375174&#8243; text_line_height=&#8221;2em&#8221; hover_enabled=&#8221;0&#8243; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]<p class=\"p1\">There is something called a local script in Roblox studio. Local scripts are scripts it affects the user\u2019s client rather than the server.<\/p>\n<p class=\"p1\"><span style=\"font-weight: 400;\">We only view a user&#8217;s client, not what the entire server can see. Our friend may be playing the same game as us, yet we may be seeing something entirely different from him.<\/span><\/p>\n<p class=\"p1\"><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;It means that the scripts that affect the server are seen by everyone and not just the individual\u2019s client. Exploring computer programs for kids can help them understand the concepts of server-side scripting and its impact on multiplayer gaming and other applications.&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:1049089,&quot;3&quot;:{&quot;1&quot;:0},&quot;12&quot;:0,&quot;23&quot;:1}\" data-sheets-textstyleruns=\"{&quot;1&quot;:0}\uee10{&quot;1&quot;:118,&quot;2&quot;:{&quot;2&quot;:{&quot;1&quot;:2,&quot;2&quot;:1136076},&quot;9&quot;:1}}\uee10{&quot;1&quot;:145}\" data-sheets-hyperlinkruns=\"{&quot;1&quot;:118,&quot;2&quot;:&quot;https:\/\/brightchamps.com\/codechamps&quot;}\uee10{&quot;1&quot;:145}\">It means that the scripts that affect the server are seen by everyone and not just the individual\u2019s client. Exploring <a href=\"https:\/\/brightchamps.com\/codechamps\">coding classes for kids<\/a><a class=\"in-cell-link\" target=\"_blank\" href=\"https:\/\/brightchamps.com\/codechamps\" rel=\"noopener\">\u00a0<\/a>can help them understand the concepts of server-side scripting and its impact on multiplayer gaming and other applications.<\/span><\/p>[\/et_pb_text][et_pb_code _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;]<!-- divi:shortcode --><!-- [et_pb_line_break_holder] -->[et_bloom_inline optin_id=&#8221;optin_8&#8243;]<!-- [et_pb_line_break_holder] --><!-- \/divi:shortcode -->[\/et_pb_code][et_pb_code _builder_version=&#8221;4.16.1&#8243; _module_preset=&#8221;default&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;][et_bloom_inline optin_id=&#8221;optin_4&#8243;][\/et_pb_code][et_pb_text _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; header_font=&#8221;Work Sans|600|||||||&#8221; header_font_size=&#8221;55px&#8221; header_letter_spacing=&#8221;1.5px&#8221; header_2_font=&#8221;Work Sans||||||||&#8221; header_2_font_size=&#8221;42px&#8221; header_3_font=&#8221;Lato|700|||||||&#8221; header_3_font_size=&#8221;32px&#8221; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;]<h2>Lua Programming FAQs<\/h2>[\/et_pb_text][et_pb_toggle title=&#8221;What is the Scripting Language Roblox Developers Use?&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; title_level=&#8221;h4&#8243; title_font=&#8221;|600|||||||&#8221; title_font_size=&#8221;18px&#8221; body_font_size=&#8221;18px&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Roblox uses Lua as the main language.<\/p>[\/et_pb_toggle][et_pb_toggle title=&#8221;Is the Roblox Lua and Lua is same?&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; title_level=&#8221;h4&#8243; title_font=&#8221;|600|||||||&#8221; title_font_size=&#8221;18px&#8221; body_font_size=&#8221;18px&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">No, they are not the same.<\/p>[\/et_pb_toggle][et_pb_toggle title=&#8221;What is the difference between the Roblox Lua and Lua?&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; title_level=&#8221;h4&#8243; title_font=&#8221;|600|||||||&#8221; title_font_size=&#8221;18px&#8221; body_font_size=&#8221;18px&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Roblox developing language Lua is similar to Lua and only it has a few minor differences. Roblox Lua is a unique scripting language that utilizes the Lua programming language.<\/p>[\/et_pb_toggle][et_pb_toggle title=&#8221;Is Lua Easy to Learn?&#8221; _builder_version=&#8221;4.18.0&#8243; _module_preset=&#8221;default&#8221; title_level=&#8221;h4&#8243; title_font=&#8221;|600|||||||&#8221; title_font_size=&#8221;18px&#8221; body_font_size=&#8221;18px&#8221; global_colors_info=&#8221;{}&#8221;]<p class=\"p1\">Yes, it is easy to learn when Compared to some other coding languages for beginners.<\/p>[\/et_pb_toggle][et_pb_divider _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; width=&#8221;21%&#8221; module_alignment=&#8221;center&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_divider][et_pb_sidebar area=&#8221;et_pb_widget_area_3&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_sidebar][\/et_pb_column][et_pb_column type=&#8221;1_4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_image src=&#8221;https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2022\/03\/Book-Free-BrightChamps-Class-Widget.jpg&#8221; alt=&#8221;Book Free BrightChamps Class Widget&#8221; title_text=&#8221;Book Free BrightChamps Class Widget&#8221; url=&#8221;https:\/\/learn.brightchamps.com\/book-trial-class?utm_source=website_organic&#038;utm_medium=blog&#038;utm_campaign=blog_sidebar&#8221; url_new_window=&#8221;on&#8221; disabled_on=&#8221;on|on|off&#8221; _builder_version=&#8221;4.16.1&#8243; _module_preset=&#8221;default&#8221; sticky_position=&#8221;top&#8221; sticky_limit_bottom=&#8221;section&#8221; sticky_position_tablet=&#8221;top&#8221; sticky_position_phone=&#8221;none&#8221; sticky_position_last_edited=&#8221;on|phone&#8221; border_radii=&#8221;on|10px|10px|10px|10px&#8221; border_color_all=&#8221;#aaaaaa&#8221; box_shadow_style=&#8221;preset1&#8243; locked=&#8221;off&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section][et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;Quote&#8221; _builder_version=&#8221;4.16&#8243; use_background_color_gradient=&#8221;on&#8221; background_color_gradient_stops=&#8221;#ffffff 0%|rgba(255,255,255,0) 70%&#8221; background_color_gradient_overlays_image=&#8221;on&#8221; background_color_gradient_start=&#8221;#ffffff&#8221; background_color_gradient_end=&#8221;rgba(255,255,255,0)&#8221; background_color_gradient_end_position=&#8221;70%&#8221; background_image=&#8221;https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2022\/02\/top-bg.png&#8221; custom_padding=&#8221;0|0px|10vw|0px|false|false&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_row column_structure=&#8221;1_2,1_2&#8243; use_custom_gutter=&#8221;on&#8221; gutter_width=&#8221;2&#8243; custom_padding_last_edited=&#8221;on|tablet&#8221; _builder_version=&#8221;4.16&#8243; background_color=&#8221;#ffffff&#8221; max_width=&#8221;1280px&#8221; custom_padding=&#8221;80px|60px|80px|60px|false|false&#8221; custom_padding_tablet=&#8221;|50px||50px||true&#8221; custom_padding_phone=&#8221;60px|40px|60px|40px|true|true&#8221; border_radii=&#8221;on|10px|10px|10px|10px&#8221; use_custom_width=&#8221;on&#8221; custom_width_px=&#8221;1280px&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; text_font=&#8221;Work Sans|700|||||||&#8221; text_text_color=&#8221;#00ac69&#8243; text_font_size=&#8221;100px&#8221; header_font=&#8221;||||||||&#8221; global_colors_info=&#8221;{}&#8221; text_font_size__hover=&#8221;14px&#8221; text_font_size__hover_enabled=&#8221;14px&#8221; text_letter_spacing__hover=&#8221;0px&#8221; text_letter_spacing__hover_enabled=&#8221;0px&#8221; text_line_height__hover=&#8221;1.7em&#8221; text_line_height__hover_enabled=&#8221;1.7em&#8221; text_text_shadow_style__hover=&#8221;none&#8221; text_text_shadow_style__hover_enabled=&#8221;none&#8221; text_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; text_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; link_font_size__hover=&#8221;14px&#8221; link_font_size__hover_enabled=&#8221;14px&#8221; link_letter_spacing__hover=&#8221;0px&#8221; link_letter_spacing__hover_enabled=&#8221;0px&#8221; link_line_height__hover=&#8221;1em&#8221; link_line_height__hover_enabled=&#8221;1em&#8221; link_text_shadow_style__hover=&#8221;none&#8221; link_text_shadow_style__hover_enabled=&#8221;none&#8221; link_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; link_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; ul_font_size__hover=&#8221;14px&#8221; ul_font_size__hover_enabled=&#8221;14px&#8221; ul_letter_spacing__hover=&#8221;0px&#8221; ul_letter_spacing__hover_enabled=&#8221;0px&#8221; ul_line_height__hover=&#8221;1em&#8221; ul_line_height__hover_enabled=&#8221;1em&#8221; ul_text_shadow_style__hover=&#8221;none&#8221; ul_text_shadow_style__hover_enabled=&#8221;none&#8221; ul_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; ul_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; ol_font_size__hover=&#8221;14px&#8221; ol_font_size__hover_enabled=&#8221;14px&#8221; ol_letter_spacing__hover=&#8221;0px&#8221; ol_letter_spacing__hover_enabled=&#8221;0px&#8221; ol_line_height__hover=&#8221;1em&#8221; ol_line_height__hover_enabled=&#8221;1em&#8221; ol_text_shadow_style__hover=&#8221;none&#8221; ol_text_shadow_style__hover_enabled=&#8221;none&#8221; ol_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; ol_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; quote_font_size__hover=&#8221;14px&#8221; quote_font_size__hover_enabled=&#8221;14px&#8221; quote_letter_spacing__hover=&#8221;0px&#8221; quote_letter_spacing__hover_enabled=&#8221;0px&#8221; quote_line_height__hover=&#8221;1em&#8221; quote_line_height__hover_enabled=&#8221;1em&#8221; quote_text_shadow_style__hover=&#8221;none&#8221; quote_text_shadow_style__hover_enabled=&#8221;none&#8221; quote_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; quote_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; text_orientation__hover=&#8221;left&#8221; text_orientation__hover_enabled=&#8221;left&#8221; background_layout__hover=&#8221;light&#8221; background_layout__hover_enabled=&#8221;light&#8221; header_2_font_size__hover=&#8221;26px&#8221; header_2_font_size__hover_enabled=&#8221;26px&#8221; header_2_letter_spacing__hover=&#8221;0px&#8221; header_2_letter_spacing__hover_enabled=&#8221;0px&#8221; header_2_line_height__hover=&#8221;1em&#8221; header_2_line_height__hover_enabled=&#8221;1em&#8221; header_2_text_shadow_style__hover=&#8221;none&#8221; header_2_text_shadow_style__hover_enabled=&#8221;none&#8221; header_2_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; header_2_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221;]&#8221;[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; text_font=&#8221;||||||||&#8221; header_font=&#8221;||||||||&#8221; header_2_font=&#8221;Work Sans|700|||||||&#8221; header_2_font_size=&#8221;35px&#8221; header_2_line_height=&#8221;1.5em&#8221; header_2_font_size_tablet=&#8221;30px&#8221; header_2_font_size_phone=&#8221;25px&#8221; header_2_font_size_last_edited=&#8221;on|phone&#8221; global_colors_info=&#8221;{}&#8221; text_font_size__hover=&#8221;14px&#8221; text_font_size__hover_enabled=&#8221;14px&#8221; text_letter_spacing__hover=&#8221;0px&#8221; text_letter_spacing__hover_enabled=&#8221;0px&#8221; text_line_height__hover=&#8221;1.7em&#8221; text_line_height__hover_enabled=&#8221;1.7em&#8221; text_text_shadow_style__hover=&#8221;none&#8221; text_text_shadow_style__hover_enabled=&#8221;none&#8221; text_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; text_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; link_font_size__hover=&#8221;14px&#8221; link_font_size__hover_enabled=&#8221;14px&#8221; link_letter_spacing__hover=&#8221;0px&#8221; link_letter_spacing__hover_enabled=&#8221;0px&#8221; link_line_height__hover=&#8221;1em&#8221; link_line_height__hover_enabled=&#8221;1em&#8221; link_text_shadow_style__hover=&#8221;none&#8221; link_text_shadow_style__hover_enabled=&#8221;none&#8221; link_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; link_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; ul_font_size__hover=&#8221;14px&#8221; ul_font_size__hover_enabled=&#8221;14px&#8221; ul_letter_spacing__hover=&#8221;0px&#8221; ul_letter_spacing__hover_enabled=&#8221;0px&#8221; ul_line_height__hover=&#8221;1em&#8221; ul_line_height__hover_enabled=&#8221;1em&#8221; ul_text_shadow_style__hover=&#8221;none&#8221; ul_text_shadow_style__hover_enabled=&#8221;none&#8221; ul_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; ul_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; ol_font_size__hover=&#8221;14px&#8221; ol_font_size__hover_enabled=&#8221;14px&#8221; ol_letter_spacing__hover=&#8221;0px&#8221; ol_letter_spacing__hover_enabled=&#8221;0px&#8221; ol_line_height__hover=&#8221;1em&#8221; ol_line_height__hover_enabled=&#8221;1em&#8221; ol_text_shadow_style__hover=&#8221;none&#8221; ol_text_shadow_style__hover_enabled=&#8221;none&#8221; ol_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; ol_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; quote_font_size__hover=&#8221;14px&#8221; quote_font_size__hover_enabled=&#8221;14px&#8221; quote_letter_spacing__hover=&#8221;0px&#8221; quote_letter_spacing__hover_enabled=&#8221;0px&#8221; quote_line_height__hover=&#8221;1em&#8221; quote_line_height__hover_enabled=&#8221;1em&#8221; quote_text_shadow_style__hover=&#8221;none&#8221; quote_text_shadow_style__hover_enabled=&#8221;none&#8221; quote_text_shadow_color__hover=&#8221;rgba(0,0,0,0.4)&#8221; quote_text_shadow_color__hover_enabled=&#8221;rgba(0,0,0,0.4)&#8221; text_orientation__hover=&#8221;left&#8221; text_orientation__hover_enabled=&#8221;left&#8221; background_layout__hover=&#8221;light&#8221; background_layout__hover_enabled=&#8221;light&#8221;]<h2>Get a Talent Discovery Certificate after trial class<\/h2>[\/et_pb_text][et_pb_button button_url=&#8221;https:\/\/learn.brightchamps.com\/book-trial-class?utm_source=website_organic&#038;utm_medium=blog&#038;utm_campaign=blog_certificate&#8221; url_new_window=&#8221;on&#8221; button_text=&#8221;Schedule a FREE Class&#8221; _builder_version=&#8221;4.17.4&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221;][\/et_pb_button][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; text_text_color=&#8221;#777777&#8243; text_font_size=&#8221;10px&#8221; global_colors_info=&#8221;{}&#8221;]<p>100% Risk-Free. No Credit Card Required<\/p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;1_2&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;44px|||&#8221; custom_padding_tablet=&#8221;0px|||&#8221; custom_padding_phone=&#8221;0px|||&#8221; custom_padding_last_edited=&#8221;on|tablet&#8221; global_colors_info=&#8221;{}&#8221; padding_tablet=&#8221;0px|||&#8221; padding_last_edited=&#8221;on|tablet&#8221; custom_padding__hover=&#8221;|||&#8221; padding_phone=&#8221;0px|||&#8221;][et_pb_image src=&#8221;https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2022\/02\/certificate.png&#8221; title_text=&#8221;certificate&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; box_shadow_style=&#8221;preset1&#8243; global_colors_info=&#8221;{}&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section]\n","protected":false},"excerpt":{"rendered":"<p>Lua Programming Language: Lua Coding Tutorial for Kids Learn Lua Coding fast with this beginner&#8217;s guide.\u00a0\u00a0Introduction to Lua ProgrammingAs a language for extending software applications, Lua was initially created in 1993 to meet the rising demand for customization at the time. It offers the fundamental programming features found in most procedural programming languages, but it [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"parent":4433,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"class_list":["post-10365","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Lua Programming Language: Guide to Lua Coding for Kids - BrightChamps Blog<\/title>\n<meta name=\"description\" content=\"Lua programming language is an open source language used for Roblox scripting. Know more about Lua coding in this tutorial guide for kids.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Lua Programming Language: Guide to Lua Coding for Kids - BrightChamps Blog\" \/>\n<meta property=\"og:description\" content=\"Lua programming language is an open source language used for Roblox scripting. Know more about Lua coding in this tutorial guide for kids.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/\" \/>\n<meta property=\"og:site_name\" content=\"BrightChamps Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BrightChamps-101266664954230\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-03T12:35:52+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"20 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/guides\\\/lua-programming-language\\\/\",\"url\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/guides\\\/lua-programming-language\\\/\",\"name\":\"Lua Programming Language: Guide to Lua Coding for Kids - BrightChamps Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-08-22T06:40:53+00:00\",\"dateModified\":\"2024-12-03T12:35:52+00:00\",\"description\":\"Lua programming language is an open source language used for Roblox scripting. Know more about Lua coding in this tutorial guide for kids.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/guides\\\/lua-programming-language\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/brightchamps.com\\\/blog\\\/guides\\\/lua-programming-language\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/guides\\\/lua-programming-language\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Coding Guides for Kids\",\"item\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/guides\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Lua Programming Language: Guide to Lua Coding for Kids\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/\",\"name\":\"BrightChamps Blog\",\"description\":\"BrightChamps Blog, also known as BrightChamps Hub is a go-to resource hub for everything on Coding for kids\",\"publisher\":{\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/#organization\",\"name\":\"BrightChamps\",\"url\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/BrightCHAMPS-logo-new-1.png\",\"contentUrl\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/BrightCHAMPS-logo-new-1.png\",\"width\":417,\"height\":80,\"caption\":\"BrightChamps\"},\"image\":{\"@id\":\"https:\\\/\\\/brightchamps.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/BrightChamps-101266664954230\\\/\",\"https:\\\/\\\/www.instagram.com\\\/brightchamps\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/brightchamps\\\/mycompany\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UC_Afe_rMGoK5Bs4nSt8QIzQ\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Lua Programming Language: Guide to Lua Coding for Kids - BrightChamps Blog","description":"Lua programming language is an open source language used for Roblox scripting. Know more about Lua coding in this tutorial guide for kids.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/","og_locale":"en_US","og_type":"article","og_title":"Lua Programming Language: Guide to Lua Coding for Kids - BrightChamps Blog","og_description":"Lua programming language is an open source language used for Roblox scripting. Know more about Lua coding in this tutorial guide for kids.","og_url":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/","og_site_name":"BrightChamps Blog","article_publisher":"https:\/\/www.facebook.com\/BrightChamps-101266664954230\/","article_modified_time":"2024-12-03T12:35:52+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"20 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/","url":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/","name":"Lua Programming Language: Guide to Lua Coding for Kids - BrightChamps Blog","isPartOf":{"@id":"https:\/\/brightchamps.com\/blog\/#website"},"datePublished":"2022-08-22T06:40:53+00:00","dateModified":"2024-12-03T12:35:52+00:00","description":"Lua programming language is an open source language used for Roblox scripting. Know more about Lua coding in this tutorial guide for kids.","breadcrumb":{"@id":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/brightchamps.com\/blog\/guides\/lua-programming-language\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/brightchamps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Coding Guides for Kids","item":"https:\/\/brightchamps.com\/blog\/guides\/"},{"@type":"ListItem","position":3,"name":"Lua Programming Language: Guide to Lua Coding for Kids"}]},{"@type":"WebSite","@id":"https:\/\/brightchamps.com\/blog\/#website","url":"https:\/\/brightchamps.com\/blog\/","name":"BrightChamps Blog","description":"BrightChamps Blog, also known as BrightChamps Hub is a go-to resource hub for everything on Coding for kids","publisher":{"@id":"https:\/\/brightchamps.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/brightchamps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/brightchamps.com\/blog\/#organization","name":"BrightChamps","url":"https:\/\/brightchamps.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/brightchamps.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2026\/03\/BrightCHAMPS-logo-new-1.png","contentUrl":"https:\/\/brightchamps.com\/blog\/wp-content\/uploads\/2026\/03\/BrightCHAMPS-logo-new-1.png","width":417,"height":80,"caption":"BrightChamps"},"image":{"@id":"https:\/\/brightchamps.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/BrightChamps-101266664954230\/","https:\/\/www.instagram.com\/brightchamps\/","https:\/\/www.linkedin.com\/company\/brightchamps\/mycompany\/","https:\/\/www.youtube.com\/channel\/UC_Afe_rMGoK5Bs4nSt8QIzQ"]}]}},"_links":{"self":[{"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/pages\/10365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/comments?post=10365"}],"version-history":[{"count":49,"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/pages\/10365\/revisions"}],"predecessor-version":[{"id":35263,"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/pages\/10365\/revisions\/35263"}],"up":[{"embeddable":true,"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/pages\/4433"}],"wp:attachment":[{"href":"https:\/\/brightchamps.com\/blog\/wp-json\/wp\/v2\/media?parent=10365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}