2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
11 #include "luaapi/luavalue.h"
12 #include "luaapi/imaging.h"
16 void lua_pushvalue(lua_State
* l
, const LuaValue
& value
) {
17 if(const double* v
= boost::get
<double>(&value
))
18 lua_pushnumber(l
, *v
);
19 else if(const QPointF
* v
= boost::get
<QPointF
>(&value
))
20 Wrapper
<QPointF
>::create(l
, *v
);
21 else if(const QRectF
* v
= boost::get
<QRectF
>(&value
))
22 Wrapper
<QRectF
>::create(l
, *v
);
24 ERROR("Unknown variant type!");
27 void lua_pushvaluemap(lua_State
* l
, const LuaValueMap
* valuemap
) {
28 lua_newtable(l
); // metatable
30 for(LuaValueMap::const_iterator it
= valuemap
->begin(); it
!= valuemap
->end(); ++it
) {
31 lua_pushvalue(l
, it
.value());
32 lua_setfield(l
, -2, it
.key().toAscii().constData());
36 } //end namespace LuaApi