blob: e0f7f35bd12a6a6b17a7feec346025fe92a3310f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#ifndef __JIN_ERROR_H
#define __JIN_ERROR_H
#include <string.h>
#include "LuaJIT/lua.hpp"
#include "libraries/luax/luax.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
|