diff options
Diffstat (limited to 'src/libjin-lua/common/je_lua_error.h')
-rw-r--r-- | src/libjin-lua/common/je_lua_error.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libjin-lua/common/je_lua_error.h b/src/libjin-lua/common/je_lua_error.h new file mode 100644 index 0000000..bd5695d --- /dev/null +++ b/src/libjin-lua/common/je_lua_error.h @@ -0,0 +1,30 @@ +#ifndef __JIN_ERROR_H +#define __JIN_ERROR_H + +#include <string.h> + +#include "common/je_lua.h" + +namespace JinEngine +{ + namespace Lua + { + + static const int FORMAT_MSG_BUFFER_SIZE = 2048; + + inline void error(lua_State* L, const char* fmt, ...) + { + char err[FORMAT_MSG_BUFFER_SIZE + 1] = { 0 }; + va_list args; + va_start(args, fmt); + vsnprintf(err + strlen(err), FORMAT_MSG_BUFFER_SIZE, fmt, args); + va_end(args); + //luax_getglobal(L, "jin"); + //luax_setfieldstring(L, "error", err); + luax_error(L, err); + } + + } // namespace Lua +} // namespace JinEngine + +#endif
\ No newline at end of file |