From f5ade518d2a6d1844c8b403c10298ac8a996f44e Mon Sep 17 00:00:00 2001 From: Michael Savage Date: Sat, 12 Mar 2011 14:02:18 +0000 Subject: [PATCH] added protips --- inc/utils.lua | 5 +++++ templates/header.lua | 1 + 2 files changed, 6 insertions(+) diff --git a/inc/utils.lua b/inc/utils.lua index 8eba6a1..7b10708 100644 --- a/inc/utils.lua +++ b/inc/utils.lua @@ -38,6 +38,11 @@ function table.copy( arr ) return new end +-- returns random element from array +function table.random( arr ) + return arr[ math.random( table.getn( arr ) ) ] +end + function math.round( num ) return math.floor( num + 0.5 ) end diff --git a/templates/header.lua b/templates/header.lua index 772a855..477eacf 100644 --- a/templates/header.lua +++ b/templates/header.lua @@ -37,3 +37,4 @@ local headerLink = loadTemplate( "headerLink" )
 
+
{{ table.random( Tips ) }}