Fix crash
parent
990b42b947
commit
0008ecc85f
10
gui.lua
10
gui.lua
|
@ -118,24 +118,24 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
cur_years = player_current_calendars[name].years
|
||||
cur_months = player_current_calendars[name].months
|
||||
if fields.today then
|
||||
show_calendar(name, ORDINAL)
|
||||
calendar.show_calendar(name, ORDINAL)
|
||||
elseif fields.next_year then
|
||||
cur_years = cur_years + 1
|
||||
show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
calendar.show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
elseif fields.prev_year then
|
||||
if cur_years == 0 then
|
||||
cur_months = 0
|
||||
else
|
||||
cur_years = cur_years - 1
|
||||
end
|
||||
show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
calendar.show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
elseif fields.next_month then
|
||||
cur_months = cur_months + 1
|
||||
if cur_months > calendar.MONTHS - 1 then
|
||||
cur_months = 0
|
||||
cur_years = cur_years + 1
|
||||
end
|
||||
show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
calendar.show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
elseif fields.prev_month then
|
||||
cur_months = cur_months - 1
|
||||
if cur_months < 0 then
|
||||
|
@ -144,7 +144,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
cur_years = cur_years - 1
|
||||
end
|
||||
end
|
||||
show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
calendar.show_calendar(name, ORDINAL, cur_months, cur_years)
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Loading…
Reference in New Issue