- Timestamp:
- Jan 24, 2007, 7:15:34 PM (18 years ago)
- Location:
- branches/scriptchanges.new/src/lib/script_engine
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/scriptchanges.new/src/lib/script_engine/script.cc
r10321 r10350 170 170 } 171 171 172 173 void Script::addObjectAsName( const std::string& className, const std::string& objectName, const std::string& nameInScript) 174 { 175 ScriptClass* scriptClass = ScriptClass::objectList().getObject(className); 176 WorldObject tmpObj; 177 if (scriptClass != NULL) 178 { 179 tmpObj.type = className; 180 if( !classIsRegistered(className) ) 181 { 182 scriptClass->registerClass(this); 183 } 184 BaseObject* object = ObjectListBase::getBaseObject(className, objectName); 185 if (object != NULL && !objectIsAdded(objectName)) 186 { 187 scriptClass->insertObject(this, object,nameInScript, false); 188 tmpObj.name = objectName; 189 registeredObjects.push_back(tmpObj); 190 } 191 } 192 } 172 193 173 194 -
branches/scriptchanges.new/src/lib/script_engine/script.h
r9869 r10350 34 34 bool loadFile(const std::string& filename); 35 35 void addObject( const std::string& className,const std::string& objectName); 36 void addObjectAsName( const std::string& className,const std::string& objectName, const std::string& nameInScript); 36 37 void registerClass(const std::string& className); //!< Register a class but dont add any instances 37 38 -
branches/scriptchanges.new/src/lib/script_engine/script_class.cc
r9916 r10350 25 25 CREATE_SCRIPTABLE_CLASS(Script, 26 26 addMethod("addObject", Executor2<Script, lua_State*,const std::string&, const std::string& >(&Script::addObject)) 27 ->addMethod("addObjectAsName", Executor3<Script, lua_State*,const std::string&, const std::string&, const std::string& >(&Script::addObjectAsName)) 27 28 ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass)) 28 29 ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction))
Note: See TracChangeset
for help on using the changeset viewer.