• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

traintastic / traintastic / 26121453997

19 May 2026 07:52PM UTC coverage: 25.063% (-0.6%) from 25.624%
26121453997

Pull #221

github

web-flow
Merge 598936246 into 15e38bcf7
Pull Request #221: Xpressnet new messages

49 of 1129 new or added lines in 16 files covered. (4.34%)

782 existing lines in 21 files now uncovered.

8483 of 33847 relevant lines covered (25.06%)

172.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

31.58
/server/src/lua/object/xpressnetinterface.cpp
1
/**
2
 * This file is part of Traintastic,
3
 * see <https://github.com/traintastic/traintastic>.
4
 *
5
 * Copyright (C) 2026 Filippo Gentile
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 */
21

22
#include "xpressnetinterface.hpp"
23
#include "interface.hpp"
24
#include "object.hpp"
25
#include "../check.hpp"
26
#include "../checkarguments.hpp"
27
#include "../checkvector.hpp"
28
#include "../push.hpp"
29
#include "../to.hpp"
30
#include "../metatable.hpp"
31

32
namespace Lua::Object {
33

34
void XpressNetInterface::registerType(lua_State* L)
99✔
35
{
36
  MetaTable::clone(L, Interface::metaTableName, metaTableName);
99✔
37
  lua_pushcfunction(L, __index);
99✔
38
  lua_setfield(L, -2, "__index");
99✔
39
  lua_pop(L, 1);
99✔
40
}
99✔
41

NEW
42
int XpressNetInterface::index(lua_State* L, ::XpressNetInterface& object)
×
43
{
NEW
44
  const auto key = to<std::string_view>(L, 2);
×
NEW
45
  LUA_OBJECT_METHOD(send)
×
NEW
46
  return Interface::index(L, object);
×
47
}
48

NEW
49
int XpressNetInterface::__index(lua_State* L)
×
50
{
NEW
51
  return index(L, *check<::XpressNetInterface>(L, 1));
×
52
}
53

NEW
54
int XpressNetInterface::send(lua_State* L)
×
55
{
NEW
56
  checkArguments(L, 1);
×
NEW
57
  auto interface = check<::XpressNetInterface>(L, lua_upvalueindex(1));
×
NEW
58
  auto message = checkVector<uint8_t>(L, 1);
×
NEW
59
  Lua::push(L, interface->send(std::move(message)));
×
NEW
60
  return 1;
×
NEW
61
}
×
62

63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc