From acc124ca9926ce21a945e1aa55d570c18161b1ca Mon Sep 17 00:00:00 2001 From: gochaism Date: Wed, 30 Apr 2014 23:54:34 +0000 Subject: [PATCH] LuaInterface: Disable auto table unpacking for vargs. Lua 5.1 does not have such a feature. print({1, 2, 3}) should pass just an array, not multiple arguments. --- LuaInterface/LuaInterface/Metatables.cs | 10 ++++++++-- output/dll/LuaInterface.dll | Bin 62464 -> 61952 bytes 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/LuaInterface/LuaInterface/Metatables.cs b/LuaInterface/LuaInterface/Metatables.cs index 9734c55a79..1d02e10cfc 100644 --- a/LuaInterface/LuaInterface/Metatables.cs +++ b/LuaInterface/LuaInterface/Metatables.cs @@ -758,6 +758,10 @@ namespace LuaInterface var luaParamValue = luaParamValueExtractor (startIndex); +#if false + // LuaTable unpacking is disabled. + // In Lua, print({1, 2, 3}) should pass an array, not multiple arguments. + // You can write print(unpack({1, 2, 3})) if necessary. if (luaParamValue is LuaTable) { LuaTable table = (LuaTable)luaParamValue; IDictionaryEnumerator tableEnumerator = table.GetEnumerator (); @@ -777,8 +781,10 @@ namespace LuaInterface paramArray.SetValue (Convert.ChangeType (value, paramArrayType), paramArrayIndex); paramArrayIndex++; } - } else { - + } + else +#endif + { paramArray = Array.CreateInstance (paramArrayType, count); paramArray.SetValue (luaParamValue, 0); diff --git a/output/dll/LuaInterface.dll b/output/dll/LuaInterface.dll index 4340bf28d5e0ff0400c7d78012e3a11bcd088504..c099565797a8617f7a3b77ed1fdfda92c3eb26dc 100644 GIT binary patch delta 2866 zcmZuzdvH|M89(2>d+$Dydy_r8N!YyDWV_2kRy07xSF8wBqkx0}4dellJV*lEgarv= zUZ5d`6bXlcN|8U9sw3J?J2#^g#m9i!&Xg%A+K$sY(V;DIA{snk+BKvr3uD(<_S_S3ov(ejgHwqN zFOJsYNaHJ>L7mH+@fx-BmZUxE>i@%TO=5;-|5;lHa90%;&JEF3B%x>)2r3c4%Po znpdHbommsBYQnIOl6W)rX%y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