lua_assert.h 488 B

12345678910111213141516
  1. /*
  2. * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "config.h"
  7. #include "lua.hpp"
  8. #if CROWN_DEBUG
  9. #define LUA_ASSERT(condition, stack, msg, ...) do { if (!(condition)) {\
  10. stack.push_fstring("\nLua assertion failed: %s\n\t" msg "\n", #condition, ##__VA_ARGS__); lua_error(stack.state()); }} while (0);
  11. #else
  12. #define LUA_ASSERT(...) ((void)0)
  13. #endif // CROWN_DEBUG