Пример #1
0
int CScriptRMI::SynchedNewIndexFunction( IFunctionHandler* pH )
{
	if (!m_pThis->m_pParent)
	{
		pH->GetIScriptSystem()->RaiseError( "Trying to set a synchronized variable with no game started... failing" );
		return pH->EndFunction();
	}

	SmartScriptTable table;
	SmartScriptTable hidden;
	const char * key;
	ScriptAnyValue value;

	if (!pH->GetParam( 1, table ))
		return pH->EndFunction(false);

	ScriptHandle id;
	if (!table->GetValue( ID_FIELD, id ))
		return pH->EndFunction(false);
	if (!table->GetValue( HIDDEN_FIELD, hidden ))
		return pH->EndFunction(false);

	if (!pH->GetParam( 2, key ))
		return pH->EndFunction(false);
	if (!pH->GetParamAny( 3, value ))
		return pH->EndFunction(false);

	hidden->SetValueAny( key, value );

	m_pThis->m_pParent->ChangedScript((EntityId) id.n );

	return pH->EndFunction( true );
}