Ok, here we go. The code below will crash in the demo_event function where it is commented and trying to call a function via function pointer. This method of using a function pointer works in CScript. How do I get it to work in lite-C?
If you can copy/paste the below into a test project. Attach the demo_action to an entity and mouse click that entity.
function pFunction();//pointer to function
function fBeep()
{
beep();
}
function demo_event()
{
if(event_type == EVENT_CLICK)
{
pFunction = ptr_for_handle(my.skill50);
pFunction();//WHY DOES IT CRASH HERE?
}
}
action demo_action()
{
my.emask = ENABLE_CLICK;
my.event = demo_event;
my.skill50 = handle(fBeep);//store handle to the fBeep function
}
Last edited by i_program_games; 09/23/07 07:43.