MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / TestObject

Function TestObject

Source/TestBase/TestLua.cpp:144–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static void TestObject(LuaCpp::State &lua) {
145 Base base = { 1, 2, 3 };
146 lua["TEST"]["base"].SetObj(base);
147 lua["TEST"]["base"].AddObjMembers(base,
148 "x", &Base::x,
149 "y", &Base::y,
150 "z", &Base::z
151 );
152 lua("print('TEST.base:y() == ', TEST.base:y())");
153
154 lua("TEST.base.testfunc = function() print('hello') end");
155 if (lua["TEST"]["base"]["testfunc"].IsFunction()) {
156 lua["TEST"]["base"]["testfunc"]();
157 }
158}
159
160struct XXX {
161 int x;

Callers 1

TestLuaFunction · 0.85

Calls 4

SetObjMethod · 0.80
AddObjMembersMethod · 0.80
IsFunctionMethod · 0.80
luaClass · 0.50

Tested by

no test coverage detected