/[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.1 by dheck, Sun Jan 5 19:56:39 2003 UTC revision 1.2 by dheck, Sun Jan 12 19:47:19 2003 UTC
# Line 155  en_get_attrib(lua_State *L) Line 155  en_get_attrib(lua_State *L)
155    
156      const tools::Value *v =  obj->get_attrib(key);      const tools::Value *v =  obj->get_attrib(key);
157      if (!v) {      if (!v) {
158          lua_error(L, "Get_Attrib: unknown attribute");          lua_error(L, "GetAttrib: unknown attribute");
159          lua_pushnil(L);          lua_pushnil(L);
160      }      }
161      else      else
# Line 163  en_get_attrib(lua_State *L) Line 163  en_get_attrib(lua_State *L)
163      return 1;      return 1;
164  }  }
165    
 enum ObjType { FLOOR, ITEM, STONE };  
   
166  static int  static int
167  en_set_floor(lua_State *L)  en_set_floor(lua_State *L)
168  {  {
# Line 274  add_constant_force(lua_State *L) Line 272  add_constant_force(lua_State *L)
272  }  }
273    
274  static int  static int
275    add_rubber_band (lua_State *L)
276    {
277        using namespace world;
278    
279        Actor  *a1       = dynamic_cast<Actor*> (to_object(L, 1));
280        Object *o2       = to_object(L, 2);
281        Actor  *a2       = dynamic_cast<Actor*>(o2);
282        Stone  *st       = dynamic_cast<Stone*>(o2);
283        double  strength = lua_tonumber(L, 3);
284        double  length   = lua_tonumber(L, 4);
285    
286        if (!a1)
287            lua_error(L, "AddRubberBand: First argument must be an actor\n");
288        else if (!a2 && !st)
289            lua_error(L, "AddRubberBand: Second argument must be actor or stone\n");
290        else {
291            if (a2)
292                world::AddRubberBand (a1, a2, strength,  length);
293            else
294                world::AddRubberBand (a1, st, strength,  length);
295        }
296        return 0;
297    }
298    
299    static int
300  get_ticks(lua_State *L)  get_ticks(lua_State *L)
301  {  {
302      lua_pushnumber(L, SDL_GetTicks());      lua_pushnumber(L, SDL_GetTicks());
# Line 294  static CFunction luafuncs[] = { Line 317  static CFunction luafuncs[] = {
317      {en_name_object,    "NameObject"},      {en_name_object,    "NameObject"},
318      {en_get_named_object,"GetNamedObject"},      {en_get_named_object,"GetNamedObject"},
319      {add_constant_force, "AddConstantForce"},      {add_constant_force, "AddConstantForce"},
320        {add_rubber_band,    "AddRubberBand"},
321      {find_data_file,    "FindDataFile"},      {find_data_file,    "FindDataFile"},
322      {get_ticks,         "GetTicks"},      {get_ticks,         "GetTicks"},
323      {0,0}      {0,0}

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

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