-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcellarmathematic.lua
More file actions
65 lines (44 loc) · 864 Bytes
/
Copy pathcellarmathematic.lua
File metadata and controls
65 lines (44 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local levels = {
0,
50,
150,
250,
400,
500,
600,
800,
1000,
1200
}
local perks = {
150,
200,
300,
350,
400,
600,
800,
1000,
1500,
2000
}
while true do
print("Что будем считать? L - Левелы, P - Перки")
local res = io.read()
local islevels = res:lower() == "l"
local tbl = islevels and levels or perks
print("Считаем "..(islevels and "левелы" or "перки")..". Текущий уровень?")
local cur = tonumber(io.read()) or 1
print("До?")
local to = tonumber(io.read()) or 1
if cur >10 or (islevels and cur < 1) or to < cur or to < 1 or to > 10 then
print("Произошла ошибка")
goto skip
end
local sum = 0
for i=(islevels and cur+1) or cur,to do
sum = sum + tbl[i]
end
print("Сумма составляет: "..sum)
::skip::
end