|
|
@ -112,13 +112,13 @@ bool luavalue_cast(int index, Color& color)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(g_lua.isTable(index)) {
|
|
|
|
if(g_lua.isTable(index)) {
|
|
|
|
g_lua.getField("r", index);
|
|
|
|
g_lua.getField("r", index);
|
|
|
|
color.setRed(g_lua.popInteger());
|
|
|
|
color.setRed((int)g_lua.popInteger());
|
|
|
|
g_lua.getField("g", index);
|
|
|
|
g_lua.getField("g", index);
|
|
|
|
color.setGreen(g_lua.popInteger());
|
|
|
|
color.setGreen((int)g_lua.popInteger());
|
|
|
|
g_lua.getField("b", index);
|
|
|
|
g_lua.getField("b", index);
|
|
|
|
color.setBlue(g_lua.popInteger());
|
|
|
|
color.setBlue((int)g_lua.popInteger());
|
|
|
|
g_lua.getField("a", index);
|
|
|
|
g_lua.getField("a", index);
|
|
|
|
color.setAlpha(g_lua.popInteger());
|
|
|
|
color.setAlpha((int)g_lua.popInteger());
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else if(g_lua.isString()) {
|
|
|
|
} else if(g_lua.isString()) {
|
|
|
|
return stdext::cast(g_lua.toString(index), color);
|
|
|
|
return stdext::cast(g_lua.toString(index), color);
|
|
|
@ -225,11 +225,20 @@ bool luavalue_cast(int index, Size& size)
|
|
|
|
void push_otml_subnode_luavalue(const OTMLNodePtr& node)
|
|
|
|
void push_otml_subnode_luavalue(const OTMLNodePtr& node)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(node->hasValue()) {
|
|
|
|
if(node->hasValue()) {
|
|
|
|
// convert boolean types
|
|
|
|
union {
|
|
|
|
if(node->value() == "true" || node->value() == "false")
|
|
|
|
bool b;
|
|
|
|
g_lua.pushBoolean(node->value<bool>());
|
|
|
|
double d;
|
|
|
|
|
|
|
|
long l;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
std::string value = node->rawValue();
|
|
|
|
|
|
|
|
if(stdext::cast(value, b))
|
|
|
|
|
|
|
|
g_lua.pushBoolean(b);
|
|
|
|
|
|
|
|
else if(stdext::cast(value, l))
|
|
|
|
|
|
|
|
g_lua.pushInteger(l);
|
|
|
|
|
|
|
|
else if(stdext::cast(value, d))
|
|
|
|
|
|
|
|
g_lua.pushNumber(d);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
g_lua.pushString(node->value());
|
|
|
|
g_lua.pushString(value);
|
|
|
|
} else if(node->hasChildren()) {
|
|
|
|
} else if(node->hasChildren()) {
|
|
|
|
g_lua.newTable();
|
|
|
|
g_lua.newTable();
|
|
|
|
bool pushedChild = false;
|
|
|
|
bool pushedChild = false;
|
|
|
|