local ScreenText = Instance.new("ScreenGui") local Frame = Instance.new("Frame") local TextButton = Instance.new("TextButton") local TextBox = Instance.new("TextBox") ScreenText.Parent = game.CoreGui Frame.Parent = ScreenText Frame.BackgroundColor3 = Color3.new(0,0,0) Frame.BorderColor3 = Color3.new(1,1,1) Frame.Position = UDim2.new(0.3,0,0.2) Frame.Size = UDim2.new(0.4,0.2,0.4) Frame.Active = true Frame.Draggable = true TextBox.Parent = Frame TextBox.BackgroundColor3 = Color3.new(1,1,1) TextBox.BackgroundTransparency = 0 TextBox.Position = UDim2.new(0.103524067, 0, 0.200333327, 0) TextBox.Size = UDim2.new(0.8,0,0.2) TextBox.Font = Enum.Font.SourceSansLight TextBox.FontSize = Enum.FontSize.Size14 TextBox.Text = "Password" TextBox.TextScaled = true TextBox.TextSize = 8 TextBox.TextWrapped = true TextButton.Parent = Frame TextButton.BackgroundColor3 = Color3.new(1,1,1) TextButton.BackgroundTransparency = 0 TextButton.Position = UDim2.new(0.3,0,0.6) TextButton.Size = UDim2.new(0.4,0,0.2) TextButton.Font = Enum.Font.SourceSansLight TextButton.FontSize = Enum.FontSize.Size14 TextButton.Text = "Confirm" TextButton.TextScaled = true TextButton.TextSize = 8 TextButton.TextWrapped = true local Frame2 = Instance.new("Frame") local TextLabel = Instance.new("TextLabel") Frame2.Parent = ScreenText Frame2.BackgroundColor3 = Color3.new(0,0,0) Frame2.BorderColor3 = Color3.new(1,1,1) Frame2.Position = UDim2.new(0.3,0,0.2) Frame2.Size = UDim2.new(0.4,0.2,0.4) Frame2.Active = false Frame2.Visible = false Frame2.Draggable = false TextLabel.Parent = Frame2 TextLabel.BackgroundColor3 = Color3.new(1,1,1) TextLabel.BackgroundTransparency = 0 TextLabel.Position = UDim2.new(0.103524067, 0, 0.200333327, 0) TextLabel.Size = UDim2.new(0.8,0,0.2) TextLabel.Font = Enum.Font.SourceSansLight TextLabel.FontSize = Enum.FontSize.Size14 TextLabel.Text = "Loading Sm0r3 UI" TextLabel.TextScaled = true TextLabel.TextSize = 8 TextLabel.TextWrapped = true local Frame3 = Instance.new("Frame") local TextLabel2 = Instance.new("TextLabel") local Texlabel3 = Instance.new("TextLabel") Frame3.Parent = ScreenText Frame3.BackgroundColor3 = Color3.new(0,0,0) Frame3.BorderColor3 = Color3.new(1,1,1) Frame3.Position = UDim2.new(0.3,0,0.2) Frame3.Size = UDim2.new(0.4,0.2,0.4) Frame3.Active = false Frame3.Visible = false Frame3.Draggable = false TextLabel2.Parent = Frame3 TextLabel2.BackgroundColor3 = Color3.new(1,1,1) TextLabel2.BackgroundTransparency = 0 TextLabel2.Position = UDim2.new(0.103524067, 0, 0.200333327, 0) TextLabel2.Size = UDim2.new(0.8,0,0.2) TextLabel2.Font = Enum.Font.SourceSansLight TextLabel2.FontSize = Enum.FontSize.Size14 TextLabel2.Text = "Sm0r3 UI Loaded!" TextLabel2.TextScaled = true TextLabel2.TextSize = 8 TextLabel2.TextWrapped = true TextLabel3.Parent = Frame3 TextLabel3.BackgroundColor3 = Color3.new(1,1,1) TextLabel3.BackgroundTransparency = 0 TextLabel3.Position = UDim2.new(0.3,0,0.6) TextLabel3.Size = UDim2.new(0.4,0,0.2) TextLabel3.Font = Enum.Font.SourceSansLight TextLabel3.FontSize = Enum.FontSize.Size14 TextLabel3.Text = "Enjoy the UI :)" TextLabel3.TextScaled = true TextLabel3.TextSize = 8 TextLabel3.TextWrapped = true TextButton.MouseButton1Click:connect(function() if TextBox.text == "Suqr3mee" then Frame.Visible = false Frame2.Visible = true wait(3) Frame2.Visible = false Frame3.Visible = true wait(1) Frame3.Visible = false end end)
Write, Run & Share Lua code online using OneCompiler's Lua online compiler for free. It's one of the robust, feature-rich online compilers for Lua language, running the latest Lua version 5.4. Getting started with the OneCompiler's Lua editor is easy and fast. The editor shows sample boilerplate code when you choose language as Lua and start coding.
OneCompiler's Lua online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Lua program which takes name as input and prints hello message with your name.
name = io.read("*a")
print ("Hello ", name)
Lua is a light weight embeddable scripting language which is built on top of C. It is used in almost all kind of applications like games, web applications, mobile applications, image processing etc. It's a very powerful, fast, easy to learn, open-source scripting language.
-- global variables
a = 10
-- local variables
local x = 30
Value Type | Description |
---|---|
number | Represents numbers |
string | Represents text |
nil | Differentiates values whether it has data or not |
boolean | Value can be either true or false |
function | Represents a sub-routine |
userdata | Represents arbitary C data |
thread | Represents independent threads of execution. |
table | Can hold any value except nil |
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition)
do
--code
end
Repeat-Until is also used to iterate a set of statements based on a condition. It is very similar to Do-While, it is mostly used when you need to execute the statements atleast once.
repeat
--code
until( condition )
For loop is used to iterate a set of statements based on a condition.
for init,max/min value, increment
do
--code
end
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increase re-usuability and modularity.
optional_function_scope function function_name( argument1, argument2, argument3........, argumentn)
--code
return params with comma seperated
end