luaL_loadbuffer patch
This commit is contained in:
parent
b93a33780a
commit
a11a63fbb3
@ -42,6 +42,9 @@ LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
|
||||
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
|
||||
lua_Integer def);
|
||||
|
||||
LUALIB_API int luaL_optboolean (lua_State *L, int idx, int def);
|
||||
LUALIB_API int luaL_checkboolean (lua_State *L, int idx);
|
||||
|
||||
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
|
||||
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
|
||||
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
|
||||
|
||||
@ -205,16 +205,16 @@ LUALIB_API int luaL_loadbuffer(lua_State *L, const char *buf, size_t size,
|
||||
#ifdef LJ_DS_LOADBUFFER_PATCH
|
||||
if (buf != name){
|
||||
if (lj_path_map){
|
||||
name = lj_path_map(name);
|
||||
if (name){
|
||||
char path[255];
|
||||
snprintf(path, 255, "@%s", name);
|
||||
const char* real_path = lj_path_map(name);
|
||||
if (real_path){
|
||||
char path[260];
|
||||
snprintf(path, 260, "@%s", real_path);
|
||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
||||
}
|
||||
}
|
||||
if (strncmp(name, "scripts/", sizeof("scripts/") -1) == 0) {
|
||||
char path[255];
|
||||
snprintf(path, 255, "@%s", name);
|
||||
char path[260];
|
||||
snprintf(path, 260, "@%s", name);
|
||||
return luaL_loadbufferx(L, buf, size, path, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user