1. A numerical controller which controls a machine tool based on a numerical control program, the numerical controller comprising: a numerical control program execution section which interprets and executes the numerical control program on a per block basis, wherein: the numerical control program execution section comprises: a function-generation calculation section which calculates, when a block of the numerical control program is a movement instruction, a function generation mode, and transmits the calculated function generation mode to a function generator; a script calling section which calls, when a block of the numerical control program is a script calling command, a script program described in a script language corresponding the script calling command; and a script execution section which loads and executes the script program called by the script calling section.