175 /// A: message table |
175 /// A: message table |
176 /// R: lm message object |
176 /// R: lm message object |
177 static int create_lm_message (lua_State *L) |
177 static int create_lm_message (lua_State *L) |
178 { |
178 { |
179 const char *mtype; |
179 const char *mtype; |
180 const char *st; |
180 const char *st = NULL; |
181 const char *to = NULL; |
181 const char *to = NULL; |
182 LmMessage *message; |
182 LmMessage *message; |
183 luaL_checktype (L, 1, LUA_TTABLE); |
183 luaL_checktype (L, 1, LUA_TTABLE); |
184 |
184 |
185 lua_getfield (L, 1, "mtype"); |
185 lua_getfield (L, 1, "mtype"); |
186 mtype = lua_tostring (L, -1); |
186 mtype = lua_tostring (L, -1); |
187 st = strchr (mtype, '-'); |
187 if (mtype) |
|
188 st = strchr (mtype, '-'); |
188 |
189 |
189 lua_getfield (L, 1, "to"); |
190 lua_getfield (L, 1, "to"); |
190 if (lua_type (L, -1) == LUA_TSTRING) |
191 if (lua_type (L, -1) == LUA_TSTRING) |
191 to = lua_tostring (L, -1); |
192 to = lua_tostring (L, -1); |
192 |
193 |