static LuaObject EvalTableConstructor(TableConstructor tctor, LuaContext Context) { Dictionary <LuaObject, LuaObject> table = new Dictionary <LuaObject, LuaObject>(); int i = 0; foreach (KeyValuePair <IExpression, IExpression> pair in tctor.Values) { if (i == tctor.Values.Count - 1 && (pair.Value is FunctionCall || pair.Value is VarargsLiteral)) // This is the last element, and this is a function call or varargs, thus we will add // every return value to the table { LuaObject key = EvalExpression(pair.Key, Context)[0]; if (key.IsNumber) { LuaArguments values = EvalExpression(pair.Value, Context); double k = key; foreach (LuaObject v in values) { table.Add(k, v); k++; } } else { LuaObject value = EvalExpression(pair.Value, Context)[0]; table.Add(key, value); } } else { LuaObject key = EvalExpression(pair.Key, Context)[0]; LuaObject value = EvalExpression(pair.Value, Context)[0]; table.Add(key, value); } i++; } return(LuaObject.FromTable(table)); }