/* /\/\ __ _ _ __ __ _ ___ / _\ ___ _ __(_)_ __ | |_ * / \ / _` | '_ \ / _` |/ _ \\ \ / __| '__| | '_ \| __| * / /\/\ \ (_| | | | | (_| | (_) |\ \ (__| | | | |_) | |_ * \/ \/\__,_|_| |_|\__, |\___/\__/\___|_| |_| .__/ \__| * |___/ |_| * A WHOLE NEW WORLD * MangoScript - Bringing a whole new world to MaNGOS * * Lua_uin64.cpp - Adds support for uint64 to the LUA engine * * (c) Copyright 2006-2007 by the MangoScript Team * * This program 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; either version 2 of the License, or * (at your option) any later version. * * This program 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. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: Lua_uint64.cpp 232 2007-04-19 11:59:13Z weedy $ */ #include "luainc.h" #include "Lua_uint64.h" #include "Log.h" lua_uint64::lua_uint64() { m_val = 0; } lua_uint64::lua_uint64(const lua_uint64& val) { this->m_val = val.m_val; } lua_uint64::lua_uint64(const uint32& val) //wont be exported but adds unit32 input support for unit64 { this->m_val = val; } lua_uint64::lua_uint64(const double& val) { this->m_val = (uint64)val; } lua_uint64::lua_uint64(const uint64& val) //wont be exported { this->m_val = val; } lua_uint64::lua_uint64(const char* val) { this->m_val = atol(val); //this isnt good _strtoui64 may be better } void lua_uint64::set(const char* val) { this->m_val = atol(val); //this isnt good _strtoui64 may be better } void lua_uint64::set(lua_uint64& val) { this->m_val = val.m_val; } lua_uint64& lua_uint64::operator=(lua_uint64& val) { this->m_val = val.m_val; return *this; } lua_uint64 lua_uint64::operator+(lua_uint64& val) { lua_uint64 res(*this); res.m_val += val.m_val; return res; } lua_uint64 lua_uint64::operator-(lua_uint64& val) { lua_uint64 res(*this); res.m_val -= val.m_val; return res; } lua_uint64 lua_uint64::operator*(lua_uint64& val) { lua_uint64 res(*this); res.m_val *= val.m_val; return res; } lua_uint64 lua_uint64::operator/(lua_uint64& val) { lua_uint64 res(*this); res.m_val /= val.m_val; return res; } void lua_uint64::dump() { debug_log("[LUA] Dumping uint64 %e", double(this->m_val)); } int lb_Export_uint64(lua_State* L) { using namespace luabind; module(L) [ class_("uint64") .def(constructor<>()) .def(constructor()) .def(constructor()) .def(constructor()) /*.def("get", &lua_uint64::dump)*/ .def("set", (void (lua_uint64::*)(const char*))&lua_uint64::set) .def("set", (void (lua_uint64::*)(lua_uint64& val))&lua_uint64::set) .def(self + lua_uint64()) .def(self - lua_uint64()) .def(self * lua_uint64()) .def(self / lua_uint64()) ]; return 0; }