4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
10 /** @file squirrel_std.hpp defines the Squirrel Standard Function class */
12 #ifndef SQUIRREL_STD_HPP
13 #define SQUIRREL_STD_HPP
15 #include "squirrel.hpp"
17 #if defined(__APPLE__)
18 /* Which idiotic system makes 'require' a macro? :s Oh well.... */
20 #endif /* __APPLE__ */
23 * By default we want to give a set of standard commands to a SQ script.
24 * Most of them are easy wrappers around internal functions. Of course we
25 * could just as easy include things like the stdmath of SQ, but of those
26 * functions we are sure they work on all our supported targets.
32 * Get the lowest of two integers.
34 static SQInteger
min(HSQUIRRELVM vm
);
37 * Get the highest of two integers.
39 static SQInteger
max(HSQUIRRELVM vm
);
42 * Load another file on runtime.
43 * @note This is always loaded on the root-level, no matter where you call this.
44 * @note The filename is always relative from the script it is called from. Absolute calls are NOT allowed!
46 static SQInteger
require(HSQUIRRELVM vm
);
49 * Enable/disable stack trace showing for handled exceptions.
51 static SQInteger
notifyallexceptions(HSQUIRRELVM vm
);
55 * Register all standard functions we want to give to a script.
57 void squirrel_register_std(Squirrel
*engine
);
60 * Register all standard functions that are available on first startup.
61 * @note this set is very limited, and is only meant to load other scripts and things like that.
63 void squirrel_register_global_std(Squirrel
*engine
);
65 #endif /* SQUIRREL_STD_HPP */