Difference between revisions of "Gkmisc"

From Vendetta Lua
Jump to: navigation, search
(date)
(date)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
=== date ===
 
=== date ===
'''Definition:'''
+
'''Definition:''' gkmisc.date([string format[, int time]]) -> string date
<br><br>
+
<br>
 
'''Description:'''<br>
 
'''Description:'''<br>
print formatted date [http://www.lua.org/manual/5.1/manual.html#5.8]<br>
+
Print formatted date; analogous to [http://www.lua.org/manual/5.1/manual.html#5.8].<br>
same as [[Os#date]] but the year is shifted ~2000 years forward (ingame date)
+
Same as [[Os#date]] but the year is shifted 2428 years forward (ingame date).<br>
<br><br>
+
Result varies depending on the client time zone.<br>
'''Arguments:'''
+
<br>
<br><br>
+
'''Arguments:''' Same as os.date<br>
'''Returns:'''
+
'''Returns:''' Same as os.date<br>
<br><br>
+
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
Line 41: Line 40:
 
=== strnatcasecmp ===
 
=== strnatcasecmp ===
 
'''Definition:'''
 
'''Definition:'''
<br><br>
+
<br>Natural Sort Order<br>
 
'''Description:'''<br>
 
'''Description:'''<br>
<br><br>
+
<br>Human readable natural sort order for strings. Similar to strnatcmp(), except that the comparison is not case sensitive. For more information see: Martin Pool's » Natural Order String Comparison page. [http://sourcefrog.net/projects/natsort/]<br>
 
'''Arguments:'''
 
'''Arguments:'''
<br><br>
+
<br>(a,b)<br>
 
'''Returns:'''
 
'''Returns:'''
<br><br>
+
<br>+1 = left side (a) smaller, 0 = equal, -1 = right side (b) smaller.<br>
 
'''Example:'''
 
'''Example:'''
<br><br>
+
<br>table.sort(my_table, function(a,b) return gkmisc.strnatcasecmp(a,b) < SORT_DIRECTION end<br>
 
+
 
+
 
+
  
 
=== strnatcmp ===
 
=== strnatcmp ===
Line 71: Line 67:
 
<br><br>
 
<br><br>
 
'''Description:'''<br>
 
'''Description:'''<br>
 +
Similar to os.time(), but returns a value in milliseconds, which doesn't depend on the system's time.
 +
For my system, floor(gkmisc.GetGameTime()/1000) + 1254130450 = os.time()
 
<br><br>
 
<br><br>
 
'''Arguments:'''
 
'''Arguments:'''
Line 78: Line 76:
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
 
  
 
=== GKGetHostName ===
 
=== GKGetHostName ===
Line 91: Line 88:
 
'''Example:'''
 
'''Example:'''
 
<br><br>
 
<br><br>
 +
 +
 +
[[Category:Tables]]

Latest revision as of 01:33, 26 June 2023

date

Definition: gkmisc.date([string format[, int time]]) -> string date
Description:
Print formatted date; analogous to [1].
Same as Os#date but the year is shifted 2428 years forward (ingame date).
Result varies depending on the client time zone.

Arguments: Same as os.date
Returns: Same as os.date
Example:

DiffTime

Definition:

Description:


Arguments:

Returns:

Example:


chatfilter

Definition:

Description:


Arguments:

Returns:

Example:


strnatcasecmp

Definition:
Natural Sort Order
Description:

Human readable natural sort order for strings. Similar to strnatcmp(), except that the comparison is not case sensitive. For more information see: Martin Pool's » Natural Order String Comparison page. [2]
Arguments:
(a,b)
Returns:
+1 = left side (a) smaller, 0 = equal, -1 = right side (b) smaller.
Example:
table.sort(my_table, function(a,b) return gkmisc.strnatcasecmp(a,b) < SORT_DIRECTION end

strnatcmp

Definition:

Description:


Arguments:

Returns:

Example:


GetGameTime

Definition:

Description:
Similar to os.time(), but returns a value in milliseconds, which doesn't depend on the system's time. For my system, floor(gkmisc.GetGameTime()/1000) + 1254130450 = os.time()

Arguments:

Returns:

Example:

GKGetHostName

Definition:

Description:


Arguments:

Returns:

Example: