From 653bef99cabc2e8610831066dfb9105ba670da32 Mon Sep 17 00:00:00 2001 From: Jason Perkins Date: Mon, 4 Feb 2013 12:38:07 -0500 Subject: [PATCH] Add warnOnce() helper method for add-on validation checks --- src/base/premake.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/base/premake.lua b/src/base/premake.lua index 1b719cdf..9aa20fe6 100644 --- a/src/base/premake.lua +++ b/src/base/premake.lua @@ -246,3 +246,20 @@ function premake.warn(message, ...) io.stderr:write(string.format("** Warning: " .. message .. "\n", ...), 0) end + + +-- +-- Displays a warning just once per run. +-- +-- @param message +-- The warning message, which may contain string formatting tokens. +-- @param ... +-- Values to fill in the string formatting tokens. +-- + + function premake.warnOnce(ctx, message, ...) + if not ctx.warnings[message] then + ctx.warnings[message] = true + premake.warn(message, ...) + end + end