MCPcopy Create free account
hub / github.com/anjo76/angelscript / buildModule2

Function buildModule2

sdk/tests/test_feature/source/test_addon_serializer.cpp:178–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178int buildModule2(asIScriptEngine* engine, asIScriptContext* /* ctx */)
179{
180 asIScriptModule* mod = engine->GetModule("TestModule", asGM_ALWAYS_CREATE);
181 mod->AddScriptSection("test",
182 "class Main \n"
183 "{ \n"
184 " private string m_string; \n"
185 " private string[]@ m_array; \n"
186 " Main() \n"
187 " { \n"
188 " print('CTOR'); \n"
189 " m_string = 'Hello, world!'; \n"
190 " string aux = 'Goodbye, cruel world'; \n"
191 " string[] somearray; \n"
192 " somearray.insertLast(aux); \n"
193 " @m_array = @somearray; \n"
194 " print(m_array[0]); \n"
195
196 " print('CTOR END'); \n"
197 " } \n"
198 " void Update() \n"
199 " { \n"
200 " print(m_string); \n"
201 " print(m_array[0]); \n"
202 " } \n"
203 "}; \n");
204 int r = mod->Build();
205
206 return r;
207}
208
209asIScriptObject* instantializeClass(bool initMembers, asIScriptEngine* engine, asIScriptContext* ctx)
210{

Callers 1

TestFunction · 0.85

Calls 3

AddScriptSectionMethod · 0.80
GetModuleMethod · 0.45
BuildMethod · 0.45

Tested by

no test coverage detected