2 Copyright (c) 2006-2008 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.
17 void lua_pushvalue(lua_State
* l
, const LuaValue
& value
) {
18 if(const double* v
= boost::get
<double>(&value
))
19 lua_pushnumber(l
, *v
);
20 else if(const QPointF
* v
= boost::get
<QPointF
>(&value
))
21 Wrapper
<QPointF
>::create(l
, *v
);
22 else if(const QRectF
* v
= boost::get
<QRectF
>(&value
))
23 Wrapper
<QRectF
>::create(l
, *v
);
25 kError() << "Unknown variant type!";
28 void lua_pushvaluemap(lua_State
* l
, const LuaValueMap
* valuemap
) {
29 lua_newtable(l
); // metatable
31 for(LuaValueMap::const_iterator it
= valuemap
->begin(); it
!= valuemap
->end(); ++it
) {
32 lua_pushvalue(l
, it
.value());
33 lua_setfield(l
, -2, it
.key().toAscii().constData());
37 } //end namespace LuaApi