public void Concat(LuaState luaState, int number) { if (number == 0) { luaState.Push(new LuaValue("", LuaValueType.String)); } else if (number >= 2) { while (number > 1) { string str1 = null; string str2 = null; if (luaState.Get(luaState.AbsIndex(-1)).ToString(ref str1) && luaState.Get(luaState.AbsIndex(-2)).ToString(ref str2)) { luaState.Pop(2); luaState.Push(new LuaValue(str1 + str2, LuaValueType.String)); --number; continue; } else { LuaValue result = null; try { var b = luaState.Pop(); var a = luaState.Pop(); if (luaState.CallMetaFunc(a, b, GetMetaFuncName(TokenType.Len), out result)) { luaState.Push(result); } } catch { throw new Exception("该类型的变量无法进行拼接"); } } } } else { throw new Exception("该类型的变量无法进行拼接"); } }