Skip to content

Instantly share code, notes, and snippets.

@kayru
Created May 6, 2012 23:32
Show Gist options
  • Save kayru/2624992 to your computer and use it in GitHub Desktop.
Save kayru/2624992 to your computer and use it in GitHub Desktop.
Premake4 vararg compatibility changes for LuaJIT 2.0
# HG changeset patch
# User Yuriy O'Donnell <[email protected]>
# Date 1336346476 -3600
# Node ID 9abcac50982464079bc7ef681fa6dccefceeb704
# Parent 1c40bd936d1f6f919f1e9bc9225621b4f9e38aad
luajit 2.0 varargs compatibility fix
diff --git a/src/base/globals.lua b/src/base/globals.lua
--- a/src/base/globals.lua
+++ b/src/base/globals.lua
@@ -147,6 +147,7 @@
--
function printf(msg, ...)
+ local arg = {...}
print(string.format(msg, unpack(arg)))
end
diff --git a/src/base/io.lua b/src/base/io.lua
--- a/src/base/io.lua
+++ b/src/base/io.lua
@@ -53,6 +53,7 @@
--
function io.printf(msg, ...)
+ local arg = {...}
if not io.eol then
io.eol = "\n"
end
@@ -90,6 +91,7 @@
--
_x = function(msg, ...)
+ local arg = {...}
for i=2, #arg do
arg[i] = premake.esc(arg[i])
end
diff --git a/src/base/os.lua b/src/base/os.lua
--- a/src/base/os.lua
+++ b/src/base/os.lua
@@ -194,6 +194,7 @@
end
function os.matchfiles(...)
+ local arg = {...}
local result = { }
for _, mask in ipairs(arg) do
domatch(result, mask, true)
diff --git a/src/base/table.lua b/src/base/table.lua
--- a/src/base/table.lua
+++ b/src/base/table.lua
@@ -157,6 +157,7 @@
--
function table.join(...)
+ local arg = {...}
local result = { }
for _,t in ipairs(arg) do
if type(t) == "table" then
diff --git a/tests/testfx.lua b/tests/testfx.lua
--- a/tests/testfx.lua
+++ b/tests/testfx.lua
@@ -68,6 +68,7 @@
function test.fail(format, ...)
-- convert nils into something more usefuls
+ local arg = {...}
for i = 1, arg.n do
if (arg[i] == nil) then
arg[i] = "(nil)"
@@ -156,6 +157,7 @@
function test.success(fn, ...)
+ local arg = {...}
local ok, err = pcall(fn, unpack(arg))
if not ok then
test.fail("call failed: " .. err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment