View Issue Details

IDProjectCategoryView StatusLast Update
0005302Multi Theft Auto : San AndreasScriptingpublic2010-05-05 12:29
ReporterAxelAssigned ToCazomino05 
PrioritynormalSeveritytrivialReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version1.0.4 
Summary0005302: Not working correctly function getCancelReason
Description

Always returns nil when reason is set.

I've found a reason in the source code, I think to fix a simple affair.

bool CStaticFunctionDefinitions::GetCancelReason ( char szReason )
{
szReason = (char
)m_pEvents->GetLastError();
if ( szReason )
{
return true;
}
return false;
}

int CLuaFunctionDefinitions::GetCancelReason ( lua_State luaVM )
{
char
szReason = NULL;
if ( CStaticFunctionDefinitions::GetCancelReason ( szReason ) )
{
lua_pushstring ( luaVM, szReason );
return 1;
}
lua_pushboolean ( luaVM, false );
return 1;
}

TagsNo tags attached.

Activities

x86

2010-04-27 19:35

administrator   ~~0011394

Do you have a example script to reproduce this ?

Axel

2010-04-27 21:18

viewer   ~~0011395

Last edited: 2010-04-27 21:32

Well here is a simple example:

function testHandler()
cancelEvent(true, 'Test reason.')
end

addEvent('testEvent')
addEventHandler('testEvent', getRootElement(), testHandler)
triggerEvent('testEvent', getRootElement())

if (wasEventCancelled()) then
print(getCancelReason())
end

Issue History

Date Modified Username Field Change