OpenTTD Source  20240919-master-gdf0233f4c2
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 */
squirrel_register_std
void squirrel_register_std(Squirrel *engine)
Register all standard functions we want to give to a script.
Definition: squirrel_std.cpp:97
SquirrelStd::max
static SQInteger max(HSQUIRRELVM vm)
Get the highest of two integers.
Definition: squirrel_std.cpp:31
SquirrelStd::min
static SQInteger min(HSQUIRRELVM vm)
Get the lowest of two integers.
Definition: squirrel_std.cpp:21
Squirrel
Definition: squirrel.hpp:23
SquirrelStd::notifyallexceptions
static SQInteger notifyallexceptions(HSQUIRRELVM vm)
Enable/disable stack trace showing for handled exceptions.
Definition: squirrel_std.cpp:75
SquirrelStd::require
static SQInteger require(HSQUIRRELVM vm)
Load another file on runtime.
Definition: squirrel_std.cpp:41
squirrel.hpp
SquirrelStd
By default we want to give a set of standard commands to a SQ script.
Definition: squirrel_std.hpp:26
squirrel_register_global_std
void squirrel_register_global_std(Squirrel *engine)
Register all standard functions that are available on first startup.
Definition: squirrel_std.cpp:89