OpenTTD Source  20241108-master-g80f628063a
squirrel_std.hpp
Go to the documentation of this file.
1 /*
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/>.
6  */
7 
10 #ifndef SQUIRREL_STD_HPP
11 #define SQUIRREL_STD_HPP
12 
13 #include "squirrel.hpp"
14 
15 #if defined(__APPLE__)
16 /* Which idiotic system makes 'require' a macro? :s Oh well.... */
17 #undef require
18 #endif /* __APPLE__ */
19 
26 class SquirrelStd {
27 public:
28 
32  static SQInteger min(HSQUIRRELVM vm);
33 
37  static SQInteger max(HSQUIRRELVM vm);
38 
44  static SQInteger require(HSQUIRRELVM vm);
45 
49  static SQInteger notifyallexceptions(HSQUIRRELVM vm);
50 };
51 
55 void squirrel_register_std(Squirrel *engine);
56 
62 
63 #endif /* SQUIRREL_STD_HPP */
By default we want to give a set of standard commands to a SQ script.
static SQInteger max(HSQUIRRELVM vm)
Get the highest of two integers.
static SQInteger require(HSQUIRRELVM vm)
Load another file on runtime.
static SQInteger notifyallexceptions(HSQUIRRELVM vm)
Enable/disable stack trace showing for handled exceptions.
static SQInteger min(HSQUIRRELVM vm)
Get the lowest of two integers.
defines the Squirrel class
void squirrel_register_std(Squirrel *engine)
Register all standard functions we want to give to a script.
void squirrel_register_global_std(Squirrel *engine)
Register all standard functions that are available on first startup.