Go through code documentation
See https://gitlab.com/4w/mtimer/issues/8
This commit is contained in:
parent
58c916e18c
commit
1c6245461b
2
init.lua
2
init.lua
@ -5,7 +5,7 @@ local S = minetest.get_translator('mtimer')
|
|||||||
|
|
||||||
-- Set initial global `mtimer` table
|
-- Set initial global `mtimer` table
|
||||||
--
|
--
|
||||||
-- The sub-table `show_formspec` is filled programmatically and is used for the
|
-- The sub-table `dialog` is filled programmatically and is used for the
|
||||||
-- functions that show the formspecs to the player.
|
-- functions that show the formspecs to the player.
|
||||||
--
|
--
|
||||||
-- In sub-table `meta` the meta keys and their default values are defined. Those
|
-- In sub-table `meta` the meta keys and their default values are defined. Those
|
||||||
|
@ -5,7 +5,8 @@ local S = m.translator
|
|||||||
-- Get translated date names
|
-- Get translated date names
|
||||||
--
|
--
|
||||||
-- This helper function takes a table containing a numerical month and a
|
-- This helper function takes a table containing a numerical month and a
|
||||||
-- numerical day of the week and returns the respecive names.
|
-- numerical day of the week and returns the respecive names that are ready
|
||||||
|
-- for being translated.
|
||||||
--
|
--
|
||||||
-- { day = 1, month = 6 } -> { day = S('Monday'), month = S('May') }
|
-- { day = 1, month = 6 } -> { day = S('Monday'), month = S('May') }
|
||||||
--
|
--
|
||||||
@ -32,7 +33,7 @@ end
|
|||||||
|
|
||||||
-- Real-world time handling
|
-- Real-world time handling
|
||||||
--
|
--
|
||||||
-- This function returns the formatted string as well a s the raw format string
|
-- This function returns the formatted string as well as the raw format string
|
||||||
-- and all the replacement values for the variables basing on what time type
|
-- and all the replacement values for the variables basing on what time type
|
||||||
-- was requested. The types are `real` for the real-world time or `session`
|
-- was requested. The types are `real` for the real-world time or `session`
|
||||||
-- for the session start time.
|
-- for the session start time.
|
||||||
@ -58,7 +59,8 @@ end
|
|||||||
-- month = month of the requested time,
|
-- month = month of the requested time,
|
||||||
-- day = day of the requested time,
|
-- day = day of the requested time,
|
||||||
-- iso8601_date = ISO 8601 date part based on the requested time,
|
-- iso8601_date = ISO 8601 date part based on the requested time,
|
||||||
-- iso8601_time = ISO 8601 time part based on the requested time
|
-- iso8601_time = ISO 8601 time part based on the requested time,
|
||||||
|
-- timestamp = the date’s timestamp
|
||||||
-- },
|
-- },
|
||||||
-- format = raw string for formatting the requeste time type,
|
-- format = raw string for formatting the requeste time type,
|
||||||
-- formatted = the formatted (all variables replaced) string
|
-- formatted = the formatted (all variables replaced) string
|
||||||
@ -157,6 +159,10 @@ end
|
|||||||
-- thus is only useful to represent the time of the day and nothing
|
-- thus is only useful to represent the time of the day and nothing
|
||||||
-- else like the date or something like that.
|
-- else like the date or something like that.
|
||||||
--
|
--
|
||||||
|
-- The generated timestamp is then passed to the os.date() default Lua function
|
||||||
|
-- to parse the human-readable interpretations. Technically this is our own
|
||||||
|
-- epoch timestamp just being reset after 86400 seconds.
|
||||||
|
--
|
||||||
-- @param player_name The name of the player to get the time for
|
-- @param player_name The name of the player to get the time for
|
||||||
-- @return table The table as described
|
-- @return table The table as described
|
||||||
local get_ingame_time = function (player_name)
|
local get_ingame_time = function (player_name)
|
||||||
|
@ -5,7 +5,7 @@ local timer = 0
|
|||||||
|
|
||||||
|
|
||||||
-- The globalstep iterates over all players every second and updates the timers
|
-- The globalstep iterates over all players every second and updates the timers
|
||||||
-- by invoking the `mtimer.update_timer` function that has ben localized to
|
-- by invoking the `mtimer.update_timer` function that has been localized to
|
||||||
-- `update_timer` for faster access.
|
-- `update_timer` for faster access.
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime;
|
timer = timer + dtime;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user