+ prop_t k = style_prop_encode(key);
+ return style_get_by_layer(s->sr, s->layer, k);
+}
+
+static void proxy_style_newindex(struct proxy_style *s, const char *key, struct style_prop *p)
+{
+ p->key = style_prop_encode(key);
+ style_set_by_layer(s->sr, s->layer, p);
+}
+
+static void push_style_prop(lua_State *L, struct style_prop *p)
+{
+ if (!p)
+ {
+ lua_pushnil(L);
+ return;
+ }
+ switch (p->type)
+ {
+ case PROP_TYPE_STRING:
+ lua_pushstring(L, osm_val_decode(p->val.id));
+ break;
+ case PROP_TYPE_NUMBER:
+ lua_pushnumber(L, (lua_Number) p->val.number);
+ break;
+ default:
+ msg(L_WARN, "Property %s has value with no LUA representation", style_prop_decode(p->key));
+ lua_pushnil(L);
+ }
+}
+
+static const char *decode_style_prop(lua_State *L, int idx, struct style_prop *p)
+{
+ if (lua_isnil(L, idx))
+ return "Cannot set property to nil. Yet."; // FIXME
+
+ if (lua_isnumber(L, idx)) // FIXME: numbers vs. strings
+ {
+ p->type = PROP_TYPE_NUMBER;
+ p->val.number = lua_tonumber(L, idx);
+ return NULL;
+ }
+
+ if (lua_isstring(L, idx))
+ {
+ p->type = PROP_TYPE_STRING;
+ p->val.id = osm_val_encode(lua_tostring(L, idx));
+ return NULL;
+ }
+
+ return "Invalid type of style property";