Go to the documentation of this file.
10 #include "../stdafx.h"
12 #include <sqstdmath.h>
15 #include "../core/alloc_func.hpp"
16 #include "../core/math_func.hpp"
17 #include "../string_func.h"
19 #include "../safeguards.h"
26 sq_getinteger(vm, 2, &tmp1);
27 sq_getinteger(vm, 3, &tmp2);
28 sq_pushinteger(vm, std::min(tmp1, tmp2));
36 sq_getinteger(vm, 2, &tmp1);
37 sq_getinteger(vm, 3, &tmp2);
38 sq_pushinteger(vm, std::max(tmp1, tmp2));
44 SQInteger top = sq_gettop(vm);
45 const SQChar *filename;
47 sq_getstring(vm, 2, &filename);
51 sq_stackinfos(vm, 1, &si);
52 if (si.source ==
nullptr) {
53 DEBUG(misc, 0,
"[squirrel] Couldn't detect the script-name of the 'require'-caller; this should never happen!");
60 SQChar *s = strrchr(path, PATHSEPCHAR);
67 #if (PATHSEPCHAR != '/')
68 for (
char *n = path; *n !=
'\0'; n++)
if (*n ==
'/') *n = PATHSEPCHAR;
77 return ret ? 0 : SQ_ERROR;
84 if (sq_gettop(vm) >= 1) {
85 if (SQ_SUCCEEDED(sq_getbool(vm, -1, &b))) {
86 sq_notifyallexceptions(vm, b);
109 sqstd_register_mathlib(engine->
GetVM());
static SQInteger max(HSQUIRRELVM vm)
Get the highest of two integers.
HSQUIRRELVM GetVM()
Get the squirrel VM.
static SQInteger min(HSQUIRRELVM vm)
Get the lowest of two integers.
bool LoadScript(const char *script)
Load a script.
static SQInteger notifyallexceptions(HSQUIRRELVM vm)
Enable/disable stack trace showing for handled exceptions.
#define DEBUG(name, level,...)
Output a line of debugging information.
void squirrel_register_global_std(Squirrel *engine)
Register all standard functions that are available on first startup.
void squirrel_register_std(Squirrel *engine)
Register all standard functions we want to give to a script.
static SQInteger require(HSQUIRRELVM vm)
Load another file on runtime.
void AddMethod(const char *method_name, SQFUNCTION proc, uint nparam=0, const char *params=nullptr, void *userdata=nullptr, int size=0)
Adds a function to the stack.
char * strecpy(char *dst, const char *src, const char *last)
Copies characters from one buffer to another.
char * strecat(char *dst, const char *src, const char *last)
Appends characters from one string to another.
#define lastof(x)
Get the last element of an fixed size array.