Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/embedded-lua/globals.lua')
-rw-r--r--3rdparty/embedded-lua/globals.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/3rdparty/embedded-lua/globals.lua b/3rdparty/embedded-lua/globals.lua
new file mode 100644
index 0000000..ec8e367
--- /dev/null
+++ b/3rdparty/embedded-lua/globals.lua
@@ -0,0 +1,30 @@
+-- Portions Copyright (c) 2002-2009 Jason Perkins and the Premake project
+
+_G.iif = function(expr, trueval, falseval)
+ if (expr) then
+ return trueval
+ else
+ return falseval
+ end
+end
+
+_G.printf = function(msg, ...)
+ _G.print(string.format(msg, unpack(arg)))
+end
+
+_G.dbgprintf = function(msg, ...)
+ os.dbgprint(string.format(msg, unpack(arg)))
+end
+
+-- An extension to type() to identify project object types by reading the
+-- "__type" field from the metatable.
+local builtin_type = _G.type
+_G.type = function(t)
+ local mt = getmetatable(t)
+ if (mt) then
+ if (mt.__type) then
+ return mt.__type
+ end
+ end
+ return builtin_type(t)
+end