Lua - Reddit
Link
click to show
click to show
is this a good first attempt a gambling game thing?
local gyumi = {"🤑", "😔", "😛", "😔", "😛", "😔"}
local win = {}
local n = 0
local money = 100
local smallw = 0
local bigw = 0
local a = 0
math.randomseed(os.time())
function bett()
print("money:"..money.."\\nhow much do you want to bet? (min 10$)")
bet = io.read("*n")
end
while money > 9 do
win = {}
::betting::
bett()
if bet < 10 then
print("the minimum amount is 10$! \\n \\n")
goto betting
elseif bet > money then
print("not enough money! \\n \\n")
goto betting
else
money = money - bet
end
for i=1,3,1
do
n = math.random(1,6)
table.insert(win, gyumi[n\])
end
for _, value in pairs(win) do
if value == "🤑" then
bigw = bigw + 1
elseif value == "😛" then
smallw = smallw + 1
end
end
if bigw == 3 then
print("jackpot!")
print(bigw)
a = bigw * 100
else
a = (bigw * 10) + smallw
end
money = money + a
print(table.concat(win))
print("won:"..a )
bigw = 0
smallw = 0
end
print("\\n\\n\\ninsufficent funds!")
https://redd.it/1x2f55k
@r_lua
1 ·