RE: Routine_ID Is No Doubt My Solution...
> >How come I get no valid routine_ids?
> Yikes, now there is a nasty programming gotcha. Somehow at the point
> where routine_id is called it appears to be searching a saved list of
> routine names known at that point during parsing... rather than the
> expected scan of the full symbol table at that point during execution!
> Maybe an over-zealous optimisation, Rob?
>
The function/procedure has to be "visible" to the routine_id() function
and therefore can't be above (in the code) those functions. So the
routine_id assignment has to occur below the function it refers to.
You could just pass both the name & the id to add_command:
procedure add_command( sequence newcommand, integer rid )
command_list = append( command_list , newcommand )
command_id = append( command_id, rid )
end procedure
function delete_all_cards()
cards = {}
return {1,""}
end function
add_command("delete_all_cards",routine_id("delete_all_cards"))
or just create a constant with the routine names and then loop through
them to get the ids. Less typing.
|
Not Categorized, Please Help
|
|