blob: 49fdfb29078f0b1534cac94e0f42610689b70f2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--
-- globals.lua
-- Global tables and variables, replacements and extensions to Lua's global functions.
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
--
--
-- "Immediate If" - returns one of the two values depending on the value of expr.
--
function iif(expr, trueval, falseval)
if (expr) then
return trueval
else
return falseval
end
end
--
-- A shortcut for printing formatted output.
--
function printf(msg, ...)
print(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 = type
function type(t)
local mt = getmetatable(t)
if (mt) then
if (mt.__type) then
return mt.__type
end
end
return builtin_type(t)
end
|