🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

module and a section

Started by
0 comments, last by WitchLord 16 years, 10 months ago
Hey guys, can anyone tell me the differences between a module and a section? And how am i able to call a class method, that ive declared in an script, like this: class test { void hi() { } }; how can i call the hi method??
Advertisement
A module is the result of the compiled script. You can think of it as a namespace, or even as a complete program.

A script section is the script files that are compiled together to form a module. You can add more than one script section to a module, and they'll all be built together in the same namespace, i.e. a function from one section can refer to a function from another section without the need to declare it in the first section.

To call a method of a script class you first need to have a pointer to the script object, i.e. the asIScriptStruct pointer, and the function id of the method you want to call. Then you call the method with the script context, setting the object pointer after the Prepare and before the Execute.

Read up on the following methods:

asIScriptEngine::CreateScriptObject
asIScriptEngine::GetMethodIDByDecl
asIScriptEngine::CreateContext
asIScriptContext::Prepare
asIScriptContext::SetObject
asIScriptContext::Execute

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement