CapsAdmin

Untitled

Mar 29th, 2011
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. #include "StdAfx.h"
  2.  
  3. #include "entity.hpp"
  4.  
  5. #include "lua\init.hpp"
  6. #include "lua\sugar\object_reg.hpp"
  7.  
  8. object(IEntity, entity)
  9.  
  10.     function(GetClass)
  11.         lua_pushstring(L, self->GetClass()->GetName());
  12.     end
  13.  
  14.     function(Remove)
  15.         gEnv->pEntitySystem->RemoveEntity(self->GetId(), true);
  16.         lua_pushnil(L);
  17.     end
  18.  
  19.     function(SetSize)
  20.         self->SetScale(Vec3(1,1,1) * lua_tonumber(L, 2));
  21.     ends
  22.  
  23.     function(__tostring)
  24.         lua_pushfstring(L, "%s[%d][%s]", PRINTNAME, self->GetId(), self->GetClass()->GetName());
  25.     end
  26.  
  27.     function(__len)
  28.         lua_pushnumber(L, self->GetId());
  29.     end
  30.  
  31.     function__index(key)
  32.         if (key == "id")
  33.         {
  34.             __len(L);
  35.  
  36.             return 1;
  37.         }
  38.         else if (key == "omg")
  39.         {
  40.             lua_pushstring(L, "HHPOOøPYLSHIT");
  41.  
  42.             return 1;
  43.         }
  44.         __luaindex()
  45.     end
  46.  
  47.     declare{
  48.         R(SetSize)
  49.  
  50.         RR(Remove, Remove)
  51.         RR(Remove, Destroy)
  52.         RR(Remove, Delete)
  53.  
  54.         R(__tostring)
  55.         R(__len)
  56.         R(__index)
  57.         R(__index1)
  58.         R(__newindex)
  59.         R(__eq)
  60.     }}
Advertisement
Add Comment
Please, Sign In to add comment