Removed override of Lua type(); no longer required by Premake APIs

This commit is contained in:
Jason Perkins 2013-11-20 13:26:52 -05:00
parent 06aa897261
commit 1ee62b13bc
5 changed files with 12 additions and 25 deletions

View File

@ -152,21 +152,3 @@
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

View File

@ -37,7 +37,6 @@
-- attach a type descriptor
setmetatable(prj, {
__type = "project",
__index = function(prj, key)
return prj.configset[key]
end,

View File

@ -43,7 +43,6 @@
-- attach a type descriptor
setmetatable(sln, {
__type = "solution",
__index = function(sln, key)
return sln.configset[key]
end,

View File

@ -38,12 +38,12 @@
--
function suite.solution_setsActiveScope()
test.isequal(api.scope.solution, sln)
test.issame(api.scope.solution, sln)
end
function suite.project_setsActiveScope()
local prj = project("MyProject")
test.isequal(api.scope.project, prj)
test.issame(api.scope.project, prj)
end
@ -56,7 +56,7 @@
project("MyProject")
group("MyGroup")
solution()
test.isequal(sln, api.scope.solution)
test.issame(sln, api.scope.solution)
test.isnil(api.scope.project)
test.isnil(api.scope.group)
end
@ -65,7 +65,7 @@
local prj = project("MyProject")
group("MyGroup")
project()
test.isequal(prj, api.scope.project)
test.issame(prj, api.scope.project)
end
@ -88,6 +88,6 @@
group("MyGroup")
configuration("Debug")
project "*"
test.isequal(sln, api.scope.solution)
test.issame(sln, api.scope.solution)
test.isnil(api.scope.project)
end

View File

@ -156,6 +156,13 @@
end
function test.issame(expected, action)
if expected ~= action then
test.fail("expected same value")
end
end
function test.istrue(value)
if (not value) then
test.fail("expected true but was false")