Changes between Version 3 and Version 4 of ScriptSystem


Ignore:
Timestamp:
09/27/07 21:20:05 (14 years ago)
Author:
art
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ScriptSystem

    v3 v4  
    3232 
    3333        // return if a wrong number of arguments were passed 
    34         if (args.size() <= 1){ 
    35                 return ScriptResult(std::string("someClass.scriptFunc(arg1) : wrong parameter count")); 
     34        if (args.size() <= 1) 
     35        { 
     36                return ScriptResult(std::string("someClass_scriptFunc(arg1) : wrong parameter count")); 
    3637        } 
    3738 
     
    5354 
    5455    // register new functions 
    55     Engine::sScriptEngine()->add("someClass.scriptFunc", someScriptFunction, param); 
     56    Engine::sScriptEngine()->add("someClass_scriptFunc", someScriptFunction, param); 
    5657} 
    5758 
     
    6061SomeClass::~SomeClass() 
    6162{ 
    62     Engine::sScriptEngine()->del("someClass.scriptFunc"); 
     63    Engine::sScriptEngine()->del("someClass_scriptFunc"); 
    6364} 
    6465 
     
    6667 
    6768 
     69When a new method is registered the engine will send an '''ScriptRegisterFunctionEvent''' on which the connected script wrappers should react to add this new function into their environment. After this a simple call of (example showed in lua): 
     70{{{ 
     71function run () 
     72    result = someClass_scriptFunc(5) 
     73end 
     74}}} 
     75will be linked with the real implementation of the script function. Of course you have to know how to react on the provided arguments. The 'result' variable will contain either a result or an error message.  
    6876 
    69 See also: ["ManualPage"], ["ResourceManagment"], ["LuaPlugin"] 
     77Since all the communication is done by strings a wrapper plugin has to know how to interpret the strings into the appropriate message or value. The scripting glue code has also to know how to translate the results given back to the script environment back. ["LuaPlugin"] is a simple glue plugin giving you access to the [http://www.lua.org/ lua] language within the engine.  
     78 
     79See also: ["ManualPage"], ["ResourceManagment"], ["LuaPlugin"], ["EventSystem"]