/[enigma]/enigma/src/lua.cc
ViewVC logotype

Diff of /enigma/src/lua.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dheck, Sun Jan 12 19:47:19 2003 UTC revision 1.3 by mhawlisch, Fri Jan 17 16:10:26 2003 UTC
# Line 172  en_set_floor(lua_State *L) Line 172  en_set_floor(lua_State *L)
172    
173      if (lua_isnil(L, 3))      if (lua_isnil(L, 3))
174          fl = 0;          fl = 0;
175      else if (is_object(L,3))      else if (is_object(L,3)) {
176          fl = static_cast<world::Floor*>(lua_touserdata(L,3));          fl = static_cast<world::Floor*>(lua_touserdata(L,3));
177      else          if( ! fl)
178                lua_error(L, "object is no valid floor");
179        } else
180          lua_error(L, "argument 3 must be an Object or nil");          lua_error(L, "argument 3 must be an Object or nil");
181      world::SetFloor(GridPos(x,y), fl);      world::SetFloor(GridPos(x,y), fl);
182      return 0;      return 0;
# Line 186  en_set_item(lua_State *L) Line 188  en_set_item(lua_State *L)
188      int x = int(lua_tonumber(L, 1));      int x = int(lua_tonumber(L, 1));
189      int y = int(lua_tonumber(L, 2));      int y = int(lua_tonumber(L, 2));
190      world::Item *it = dynamic_cast<world::Item*>(to_object(L, 3));      world::Item *it = dynamic_cast<world::Item*>(to_object(L, 3));
191        if( ! it)
192            lua_error(L, "object is no valid item");
193      world::SetItem(GridPos(x,y), it);      world::SetItem(GridPos(x,y), it);
194      return 0;      return 0;
195  }  }
# Line 195  en_set_stone(lua_State *L) Line 199  en_set_stone(lua_State *L)
199      int x = int(lua_tonumber(L, 1));      int x = int(lua_tonumber(L, 1));
200      int y = int(lua_tonumber(L, 2));      int y = int(lua_tonumber(L, 2));
201      world::Stone *st = dynamic_cast<world::Stone*>(to_object(L, 3));      world::Stone *st = dynamic_cast<world::Stone*>(to_object(L, 3));
202        if( ! st)
203            lua_error(L, "object is no valid stone");
204      world::SetStone(GridPos(x,y), st);      world::SetStone(GridPos(x,y), st);
205      return 0;      return 0;
206  }  }
# Line 213  en_set_actor(lua_State *L) Line 219  en_set_actor(lua_State *L)
219      double x = lua_tonumber(L,1);      double x = lua_tonumber(L,1);
220      double y = lua_tonumber(L,2);      double y = lua_tonumber(L,2);
221      world::Actor *ac = dynamic_cast<world::Actor*>(to_object(L, 3));      world::Actor *ac = dynamic_cast<world::Actor*>(to_object(L, 3));
222        if( ! ac)
223            lua_error(L, "object is no valid actor");
224      world::AddActor(x, y, ac);      world::AddActor(x, y, ac);
225      return 0;      return 0;
226  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26