MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / Register

Method Register

TombEngine/Scripting/Internal/TEN/Types/Time/Time.cpp:17–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 // @pragma nostrip
16
17 void Time::Register(sol::table& parent)
18 {
19 using ctors = sol::constructors<
20 Time(), Time(int),
21 Time(const std::string&), Time(const sol::table&)>;
22
23 parent.new_usertype<Time>(
24 "Time", ctors(),
25 sol::call_constructor, ctors(),
26
27 // Meta functions
28 sol::meta_function::to_string, &Time::ToString,
29 sol::meta_function::equal_to, &Time::operator ==,
30 sol::meta_function::less_than, &Time::operator <,
31 sol::meta_function::less_than_or_equal_to, &Time::operator <=,
32
33 sol::meta_function::addition, sol::overload(
34 [](const Time& time0, const Time& time1) { return (time0 + time1); },
35 [](const Time& time, int gameFrames) { return (time + gameFrames); }),
36 sol::meta_function::subtraction, sol::overload(
37 [](const Time& time0, const Time& time1) { return (time0 - time1); },
38 [](const Time& time, int gameFrames) { return (time - gameFrames); }),
39
40 // Methods
41 "GetTimeUnits", &Time::GetTimeUnits,
42 "GetFrameCount", &Time::GetFrameCount,
43
44 // Readable and writable fields
45 "h", sol::property(&Time::GetHours, &Time::SetHours),
46 "m", sol::property(&Time::GetMinutes, &Time::SetMinutes),
47 "s", sol::property(&Time::GetSeconds, &Time::SetSeconds),
48 "c", sol::property(&Time::GetCentiseconds, &Time::SetCentiseconds));
49 }
50
51 /// Create a Time object.
52 // @function Time

Callers

nothing calls this directly

Calls 2

overloadFunction · 0.85
propertyFunction · 0.85

Tested by

no test coverage detected