src/squirrel_std.cpp
author rubidium
Sun, 25 Mar 2007 15:22:56 +0000
branchnoai
changeset 9528 b2cc6f31363c
parent 9487 0575126e0267
child 9577 8e93be390b45
permissions -rw-r--r--
(svn r9448) [NoAI] -Codechange: extend the squirrel_export script to update ai_squirrel too.

#include <squirrel.h>
#include "stdafx.h"
#include "squirrel.hpp"
#include "squirrel_std.hpp"
#include "helpers.hpp"

/* abs() is normally defined to myabs(), which we don't want in this file */
#undef abs

SQInteger SquirrelStd::abs(HSQUIRRELVM vm)
{
	SQInteger tmp;

	sq_getinteger(vm, 2, &tmp);
	sq_pushinteger(vm, myabs(tmp));
	return 1;
}

void squirrel_register_std(Squirrel *engine)
{
	/* We don't use squirrel_helper here, as we want to register to the global
	 *  scope and not to a class. */
	engine->AddMethod("abs", &SquirrelStd::abs, 2, "xi");
}