All Activities

Write a Lua Script to Print Your Name

Write a Lua Script to Print Your Name
Green highlight

Write a simple Lua script that prints your name on the screen, learning basic coding ideas like strings, the print function, and running code.

Orange shooting star
Background blob
Challenge Image
Skill Badge
Table of contents

Step-by-step guide to write a Lua script to print your name

What you need
Online lua editor (like repl.it or lua.org demo), basic typing skills

Step 1

Open your web browser and go to an online Lua editor like repl.it or the Lua.org demo.

Step 2

Start a new Lua file or project in the editor.

Step 3

Click inside the code area so the cursor is ready to type.

Step 4

Type print("Your Name") and replace Your Name with the name you want the program to show.

Step 5

Save the file or give your project a name if the editor asks.

Step 6

Press the Run button in the editor to run your Lua script.

Step 7

Look at the output area and read the name your program printed.

Step 8

Change the text inside the quotes to a nickname or a different name.

Step 9

Press Run again to see the new name appear on the screen.

Step 10

Add a second line and type print("Hi! I'm Your Name") to make a friendly greeting.

Step 11

Run your program one more time to see both lines print.

Step 12

Share your finished Lua script and a screenshot or description of what it prints on DIY.org

Help!?

What can we use if we can't access repl.it or the Lua.org demo?

If you can't access repl.it or the Lua.org demo, install the Lua interpreter and run your file with the lua command or use another online IDE that supports Lua, then create a file, type print("Your Name"), save, and Run.

Why does my program show an error or nothing when I press Run?

If you get an error or no output after pressing Run, make sure you typed print("Your Name") with straight quotes and parentheses, selected Lua as the language in the editor, saved the file if the editor needs it, and checked the output/console area.

How can we adapt this activity for different ages?

For younger children, have an adult type and press Run while the child picks names, and for older kids, replace the hard-coded name with a variable and io.read() or add the second line print("Hi! I'm "..name) to practice input and string concatenation.

What's a fun way to extend or personalize the script before uploading a screenshot to DIY.org?

Personalize it by changing the text inside the quotes to a nickname, adding the second line print("Hi! I'm Your Name"), or modify the script to ask for a name with io.read() and then print a custom greeting so the output makes a neat screenshot for DIY.org.

Watch videos on how to write a Lua script to print your name

0:00/0:00

Here at SafeTube, we're on a mission to create a safer and more delightful internet. ๐Ÿ˜Š

Learning the English Alphabet for Kids | Writing the letter โ€˜Lโ€™ | Using Crayon and Paint

4 Videos
Learning the English Alphabet for Kids | Writing the letter  โ€˜Lโ€™ | Using Crayon and Paint

Learning the English Alphabet for Kids | Writing the letter โ€˜Lโ€™ | Using Crayon and Paint

Writing Letter 'e' in English | Phonics Sounds | How to write the letter 'e' for kids

Writing Letter 'e' in English | Phonics Sounds | How to write the letter 'e' for kids

Letter X - Cursive Script - The alphabet for kids

Letter X - Cursive Script - The alphabet for kids

Letter W: cursive script - The alphabet for kids

Letter W: cursive script - The alphabet for kids

Facts about programming basics for kids

๐ŸŒ™ Lua means "moon" in Portuguese โ€” the language was created in Brazil!

๐Ÿง‘โ€๐Ÿ’ป Lua is tiny and fast: its core is only a few kilobytes, so itโ€™s great for embedding in games and apps.

๐Ÿ“ The classic first program is "Hello, world!" โ€” printing your name is the same fun first step.

๐ŸŽฎ Popular games and platforms like Roblox and World of Warcraft use Lua for scripting behaviors.

๐Ÿ”ค In Lua you can write strings with single or double quotes, e.g., print('Your Name') or print("Your Name").

How do you write a Lua script to print your name?

To write a Lua script that prints your name, open a text editor and type: print("Your Name"). Save the file as myname.lua. Run it with a Lua interpreter on your computer (lua myname.lua) or paste into an online Lua sandbox. Explain that text inside quotes is a string and print shows output. Try changing the text and running again to see how code changes produce different results.

What materials do I need to write a Lua name-printing script?

You need a computer, tablet, or Chromebook with a simple text editor (Notepad, TextEdit, or code editor) and a Lua interpreter or access to an online Lua editor. A keyboard helps typing, though touchscreens and coding apps work too. Optional items: a parent or teacher for guidance, and an internet connection if you use web-based sandboxes. No special hardware is required for this basic activity.

What ages is writing a Lua print script suitable for?

This activity suits children aged about 7โ€“14. Ages 7โ€“9 can try it with adult help to type, save, and run the script. Ages 10โ€“12 often work independently and enjoy experimenting with changes. Teens can extend the task by adding variables or multiple print statements. Adjust support for each childโ€™s reading and typing skills and pair younger kids with a grown-up for guidance.

What are the benefits and safe variations of this Lua activity?

Benefits include learning strings, the print function, and how code runs, boosting logic and confidence. Safety tips: supervise internet use and be careful installing software; use online sandboxes or offline interpreters you trust. Variations: print multiple lines, store the name in a variable (local name = "Alex"; print(name)), or make a simple greeting that asks for input. These extensions encourage creativity and problem-solving.

Ready to create?

Make

To create a safe space for kid creators worldwide!

Create

Vibe Coding

Kids GPT

All Tools

Kibu

Learn

Worksheets

Courses

Skills

Resources

SafeTube

Blog

FAQ

Pricing

Account

Log-in

Sign-up

Data Deletion

Company

About

Community Guidelines

Privacy Policy

Terms of Service

2025, URSOR LIMITED. All rights reserved. DIY is in no way affiliated with Minecraftโ„ข, Mojang, Microsoft, Robloxโ„ข or YouTube. LEGOยฎ is a trademark of the LEGOยฎ Group which does not sponsor, endorse or authorize this website or event. Made with love in San Francisco.