-- CAUTION, I didnt write any of the tables. My friend did who doesnt know ***** about coding.
-- Please dont attack me :sob:
-- Anyways this is a simulation of a twitch stream that randomizes each message with its own user
-- and messages. making any line in the output its own unique line. have fun!
-- Idea made by my friend
-- coding by me

local users = {
  "sigma",
  "skibdi",
  "gyat",
  "man",
  "toilet",
  "fan",
  "rizzy",
  "girl",
  "diddy",
  "kingvon",
  "nut",
  "annefrank",
  "drakeypoo",
  "youssef",
  "dream",
  "kai"
}

local phrasesStart = {
 "I need to rizz up some ",
 "this is so ",
 "i hate ",
 "i love ",
 "i wanna ",
 "im feeling kinda ",
 "hi ",
 "you look ",
 "i just wanna ",
 "please let me ",
 "touch me "
}

local phrasesEnd = {
  "gayats",
  "rizzy",
  "booty",
  "monkeys",
  "diddy",
  "nut",
  "those who know",
  "baby oil",
  "please",
  "batakam",
  "skibanut",
  "youssef",
  "winter arc",
  "good boy",
  "diddy sauce",
  "demon king is back"
}

local DonatStartUsers = {
"mrbreast",
"kaicenat",
"fanum",
"dream",
"Rkelly",
"james charles",
"foxy",
"dreamybullxxx",
"minos prime",
"buggy the clown",
"maurice"
}

local DonatStartPHR1 = {
  "please ",
  "stupid ",
  "im suuupr rich and i hate ",
  "niqqer ",
  "yes ",
"i will ",
"no ",
}

local DonatStartPHR2 = {
"hoe",
"idiot",
"batakuuuuum!!!!",
"penith",
"king",
"ksi",
"retarb",
"bruh",
"fat acces",
"niqqa",
"midgets",
"shut up",
"pluh",
"sprunki sprunki sprunki"
}

local prices = {
  "1 dollar 99 cents",
  "500 dollars",
  "1 rupie",
  "5 dirhem",
  "18 robux",
  "7 vbucks",
  "10 minecoins",
  "800 CP (cod points)"
}

local streamer = {
  "spongebob",
  "anne frank",
  "adolf hitler",
  "taylor swift",
  "Mia Khalifa",
  "You",
  "abdul",
  "eye of rah",
  "mr goonside",
  "Tiramisu"
}
local minosprimelines = {
  "JUDGEMENT!",
  "PREPARE THYSELF!",
  "DIE!",
  "CRUSH!",
  "THY END IS NOW!",
  "WEAK!",
  "USELESS!"
}

local emojis = {
  "😂",
  "🤓",
  "💀",
  "🔥",
  "😭",
  "🥷",
  "🫃",
  "😈"
}

local RandomStreamer = math.random(1, #streamer)
if RandomStreamer == 6 then
  print(string.upper(streamer[RandomStreamer].." are live!"))
else
  print(string.upper(streamer[RandomStreamer].." is live!"))
end


while true do
  local minosprimelinesRan = math.random(1, #minosprimelines)
  local minosprimelinesRan2 = math.random(1, #minosprimelines)
  local Username = math.random(1, #users)
  local Username2 = math.random(1, #users)
  local UserNumber = math.random(100, 999)
  local emojichance = math.random(1, 5)
  local emojidecider = math.random(1, #emojis)
  local donatechance = math.random(1, 25)
  local UserDon = math.random(1, #DonatStartUsers)
  local DonatePhraseStart = math.random(1, #DonatStartPHR1)
  local DonatePhraseEnd = math.random(1, #DonatStartPHR2)
  local Sphrasesstart = math.random(1, #phrasesStart)
  local phrasesenders = math.random(1, #phrasesEnd)
  local pricegamble = math.random(1, #prices)
  if emojichance == 1 then
    print("@"..users[Username]..users[Username2]..UserNumber..": "..phrasesStart[Sphrasesstart]..phrasesEnd[phrasesenders].." "..emojis[emojidecider])
  else
    print("@"..users[Username]..users[Username2]..UserNumber..": "..phrasesStart[Sphrasesstart]..phrasesEnd[phrasesenders])
  end
  if donatechance == 1 then
    if UserDon == 9 then
      print("@"..DonatStartUsers[UserDon].." donated "..prices[pricegamble].." through superchat!: "..minosprimelines[minosprimelinesRan].." "..minosprimelines[minosprimelinesRan2])
    else
      print("@"..DonatStartUsers[UserDon].." donated "..prices[pricegamble].." through superchat!: "..DonatStartPHR1[DonatePhraseStart]..DonatStartPHR2[DonatePhraseEnd])
    end
  end
end 
by

Lua online compiler

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.

Taking inputs (stdin)

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)

About Lua

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.

Syntax help

Variables

  • By default all the variables declared are global variables
  • If the variables are explicitly mentioned as local then they are local variables.
  • Lua is a dynamically typed language and hence only the values will have types not the variables.

Examples

-- global variables
a = 10

-- local variables

local x = 30
Value TypeDescription
numberRepresents numbers
stringRepresents text
nilDifferentiates values whether it has data or not
booleanValue can be either true or false
functionRepresents a sub-routine
userdataRepresents arbitary C data
threadRepresents independent threads of execution.
tableCan hold any value except nil

Loops

1. While:

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

2. Repeat-Until:

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 )

3. For:

For loop is used to iterate a set of statements based on a condition.

for init,max/min value, increment
do
   --code
end

Functions

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