Menu
Coddy logo textTech

Recap - Format Username

Part of the Fundamentals section of Coddy's Lua journey — lesson 49 of 90.

challenge icon

Challenge

Easy

Create a username processing system that standardizes and shortens usernames for display purposes. Declare a variable called rawUsername and assign it the value "GameMaster2024". First, use string.lower() to convert the entire username to lowercase and store the result in a variable called lowercaseUsername. Then, use string.sub() to extract the first 5 characters from the lowercase username and store this shortened version in a variable called displayUsername. Print the final display username.

Try it yourself

-- Declare the rawUsername variable
local rawUsername = "GameMaster2024"

-- TODO: Write your code here
-- Convert to lowercase and store in lowercaseUsername
-- Extract first 5 characters and store in displayUsername

-- Print the final display username
print(displayUsername)

All lessons in Fundamentals