Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. void LuaScripting::ExecuteHook(Entity *_entity, const char *_hook, int _value)
  2. {
  3. tolua_pushusertype(m_luaState, (void*)_entity, "Entity");
  4. lua_setglobal(m_luaState, "entity");
  5. lua_pop(m_luaState, 1);
  6. if (RunScript(_entity->GetName())) {
  7. lua_getglobal(m_luaState, _hook);
  8. if (lua_isfunction(m_luaState, -1)) {
  9. lua_pushnumber(m_luaState, _value);
  10. if (!strcmp(_hook, "onMouseOver") || !strcmp(_hook, "onMouseLeave")) {
  11. lua_call(m_luaState, 0, 0);
  12. } else {
  13. lua_call(m_luaState, 1, 0);
  14. }
  15. }
  16. ResetEntityFileGlobals();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement