2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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/>.
8 /** @file squirrel_std.hpp defines the Squirrel Standard Function class */
10 #ifndef SQUIRREL_STD_HPP
11 #define SQUIRREL_STD_HPP
13 #include "squirrel.hpp"
15 #if defined(__APPLE__)
16 /* Which idiotic system makes 'require' a macro? :s Oh well.... */
18 #endif /* __APPLE__ */
21 * By default we want to give a set of standard commands to a SQ script.
22 * Most of them are easy wrappers around internal functions. Of course we
23 * could just as easy include things like the stdmath of SQ, but of those
24 * functions we are sure they work on all our supported targets.
30 * Get the lowest of two integers.
32 static SQInteger
min(HSQUIRRELVM vm
);
35 * Get the highest of two integers.
37 static SQInteger
max(HSQUIRRELVM vm
);
40 * Load another file on runtime.
41 * @note This is always loaded on the root-level, no matter where you call this.
42 * @note The filename is always relative from the script it is called from. Absolute calls are NOT allowed!
44 static SQInteger
require(HSQUIRRELVM vm
);
47 * Enable/disable stack trace showing for handled exceptions.
49 static SQInteger
notifyallexceptions(HSQUIRRELVM vm
);
53 * Register all standard functions we want to give to a script.
55 void squirrel_register_std(Squirrel
*engine
);
58 * Register all standard functions that are available on first startup.
59 * @note this set is very limited, and is only meant to load other scripts and things like that.
61 void squirrel_register_global_std(Squirrel
*engine
);
63 #endif /* SQUIRREL_STD_HPP */