Update of /cvsroot/wxlua/wxLua/modules/wxlua/src
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31238/wxLua/modules/wxlua/src
Modified Files:
wxlstate.cpp
Log Message:
Index: wxlstate.cpp
===================================================================
RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/src/wxlstate.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** wxlstate.cpp 13 Sep 2006 04:13:46 -0000 1.76
--- wxlstate.cpp 28 Sep 2006 22:26:05 -0000 1.77
***************
*** 1555,1565 ****
}
! int wxLuaState::CompileString(const wxString &script, const wxString& name)
{
wxLuaCharBuffer buf(script);
! int status = CompileBuffer((unsigned char*)buf.GetData(), buf.Length(), name);
return status;
}
! int wxLuaState::CompileBuffer(const unsigned char buf[], size_t size, const wxString &name)
{
lua_State *L = lua_open();
--- 1555,1565 ----
}
! int wxLuaState::CompileString(const wxString &script, const wxString& name, wxString* errMsg_, int* line_num_)
{
wxLuaCharBuffer buf(script);
! int status = CompileBuffer((unsigned char*)buf.GetData(), buf.Length(), name, errMsg_, line_num_);
return status;
}
! int wxLuaState::CompileBuffer(const unsigned char buf[], size_t size, const wxString &name, wxString* errMsg_, int* line_num_)
{
lua_State *L = lua_open();
***************
*** 1567,1571 ****
int top = lua_gettop(L);
int status = luaL_loadbuffer(L, (const char*)buf, size, wx2lua(name));
! status = LuaError(status, top);
lua_close(L);
return status;
--- 1567,1571 ----
int top = lua_gettop(L);
int status = luaL_loadbuffer(L, (const char*)buf, size, wx2lua(name));
! status = LuaError(status, top, L, errMsg_, line_num_);
lua_close(L);
return status;
***************
*** 1614,1621 ****
}
! int wxLuaState::LuaError(int status, int top)
{
! wxCHECK_MSG(Ok(), status, wxT("Invalid wxLuaState"));
! lua_State* L = M_WXLSTATEDATA->m_lua_State;
int newtop = lua_gettop(L);
--- 1614,1624 ----
}
! int wxLuaState::LuaError(int status, int top, lua_State* L, wxString* errMsg_, int* line_num)
{
! if (L == NULL)
! {
! wxCHECK_MSG(Ok(), status, wxT("Invalid wxLuaState"));
! L = M_WXLSTATEDATA->m_lua_State;
! }
int newtop = lua_gettop(L);
***************
*** 1669,1672 ****
--- 1672,1678 ----
SendEvent(event);
lua_settop(L, top);
+
+ if (errMsg_) *errMsg_ = errorMsg;
+ if (line_num) *line_num = (int)line;
}
|