Métodos públicos | |
| int | GetFunctionIdByDecl (char *functionPrototype) |
| bool | Prepare (char *functionPrototype) |
| bool | Prepare (int funcId) |
| bool | Execute () |
| bool | LoadScript (char *filename) |
| bool | LoadByteCode (char *filename) |
| bool | SaveByteCode (char *filename) |
| bool | ExecuteString (char *script) |
| int | SetArgDWord (int iArg, asDWORD value) |
| int | SetArgQWord (int iArg, asQWORD value) |
| int | SetArgFloat (int iArg, float value) |
| int | SetArgDouble (int iArg, double value) |
| int | SetArgObject (int iArg, void *object) |
| asDWORD | GetReturnDWord () |
| asQWORD | GetReturnQWord () |
| float | GetReturnFloat () |
| double | GetReturnDouble () |
| void * | GetReturnObject () |
Amigas | |
| class | ScriptMgr |
// Codigo C++ bool TestGame::OnInit() { int ap = 10; if (!ScriptMgr::StartUp()) return false; // Registro la variable ap en el sistema de script int result = ScriptMgr::RegisterGlobalProperty("int ap",&ap); // Pido un nuevo script en el módulo ZakEngine y la sección namespace _script = ScriptMgr::AddScript("ZakEngine", "namespace"); // Cargo el script _script->LoadScript("data/scripts/script.as"); // Compilo el módulo if (!ScriptMgr::CompileModule("ZakEngine")) return false; // Pido el id de la función _func = _script->GetFunctionIdByDecl("void DoSomething(int x)"); // Preparo la función _script->Prepare(_func); // Paso al argumento 0 (el primero de tipo DWord) el valor 5 _script->SetArgDWord(0,5); // Ejecuto el script _script->Execute(); } bool TestGame::OnShutdown() { // Elimino la lista de scripts ScriptMgr::ClearScriptList(); return true; }
// Codigo en AngelScript void DoSomething(int x) { ap = x; }
| int zak::Script::GetFunctionIdByDecl | ( | char * | functionPrototype | ) |
Devuelve el índice de la función según su prototipo
| functionPrototype | prototipo de la función |
| bool zak::Script::Prepare | ( | char * | functionPrototype | ) |
Prepara la función para ser ejecutada.
| functionPrototype | prototipo de la función |
| bool zak::Script::Prepare | ( | int | funcId | ) |
Prepara la función para ser ejecutada.
| funcId | índice de la función obtenido por medio del método GetFunctionIdByDecl |
| bool zak::Script::Execute | ( | ) |
Ejecuta la función preparada
| bool zak::Script::LoadScript | ( | char * | filename | ) |
Carga un script en texto
| bool zak::Script::LoadByteCode | ( | char * | filename | ) |
Carga un script precompilado (binario) Todavía no está desarrollado
| bool zak::Script::ExecuteString | ( | char * | script | ) |
Ejecuta una sentencia pasada en una cadena de caracteres
| script | la sentencia a ejecutar |
| int zak::Script::SetArgDWord | ( | int | iArg, | |
| asDWORD | value | |||
| ) | [inline] |
Pasa un argumento del tipo DWord por parámetro a la función a ser ejecutada.
| iArg | número de argumento donde el primero es 0 | |
| value | valor a pasar por parámetro |
| int zak::Script::SetArgQWord | ( | int | iArg, | |
| asQWORD | value | |||
| ) | [inline] |
Pasa un argumento del tipo QWord por parámetro a la función a ser ejecutada.
| iArg | número de argumento donde el primero es 0 | |
| value | valor a pasar por parámetro |
| int zak::Script::SetArgFloat | ( | int | iArg, | |
| float | value | |||
| ) | [inline] |
Pasa un argumento del tipo float por parámetro a la función a ser ejecutada.
| iArg | número de argumento donde el primero es 0 | |
| value | valor a pasar por parámetro |
| int zak::Script::SetArgDouble | ( | int | iArg, | |
| double | value | |||
| ) | [inline] |
Pasa un argumento del tipo double por parámetro a la función a ser ejecutada.
| iArg | número de argumento donde el primero es 0 | |
| value | valor a pasar por parámetro |
| int zak::Script::SetArgObject | ( | int | iArg, | |
| void * | object | |||
| ) | [inline] |
Pasa un objeto por parámetro a la función a ser ejecutada.
| iArg | número de argumento donde el primero es 0 | |
| value | valor a pasar por parámetro |
| asDWORD zak::Script::GetReturnDWord | ( | ) | [inline] |
Retorna un valor del tipo DWord de la función ejecutada anteriormente.
| asQWORD zak::Script::GetReturnQWord | ( | ) | [inline] |
Retorna un valor del tipo QWord de la función ejecutada anteriormente.
| float zak::Script::GetReturnFloat | ( | ) | [inline] |
Retorna un valor del tipo float de la función ejecutada anteriormente.
| double zak::Script::GetReturnDouble | ( | ) | [inline] |
Retorna un valor del tipo double de la función ejecutada anteriormente.
| void* zak::Script::GetReturnObject | ( | ) | [inline] |
Retorna un objeto de la función ejecutada anteriormente.
1.5.1-p1