|
@@ -1,6 +1,7 @@
|
|
|
#include "precompiled.h"
|
|
#include "precompiled.h"
|
|
|
#include <Rocket/Controls/Controls.h>
|
|
#include <Rocket/Controls/Controls.h>
|
|
|
#include <Rocket/Core/Core.h>
|
|
#include <Rocket/Core/Core.h>
|
|
|
|
|
+#include <Rocket/Core/Lua/Interpreter.h>
|
|
|
|
|
|
|
|
namespace Rocket {
|
|
namespace Rocket {
|
|
|
namespace Core {
|
|
namespace Core {
|
|
@@ -126,6 +127,7 @@ int LuaType<T>::thunk(lua_State* L)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
template<typename T>
|
|
template<typename T>
|
|
|
void LuaType<T>::tostring(char* buff, void* obj)
|
|
void LuaType<T>::tostring(char* buff, void* obj)
|
|
|
{
|
|
{
|
|
@@ -199,7 +201,8 @@ int LuaType<T>::index(lua_State* L)
|
|
|
if(lua_type(L,-1) == LUA_TFUNCTION) //[-1 = 5]
|
|
if(lua_type(L,-1) == LUA_TFUNCTION) //[-1 = 5]
|
|
|
{
|
|
{
|
|
|
lua_pushvalue(L,1); //push the userdata to the stack [6]
|
|
lua_pushvalue(L,1); //push the userdata to the stack [6]
|
|
|
- lua_pcall(L,1,1,0); //remove one, result is at [6]
|
|
|
|
|
|
|
+ if(lua_pcall(L,1,1,0) != 0) //remove one, result is at [6]
|
|
|
|
|
+ Interpreter::Report(L, String(GetTClassName<T>()).Append(".__index for ").Append(lua_tostring(L,2)).Append(": "));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -212,7 +215,8 @@ int LuaType<T>::index(lua_State* L)
|
|
|
{
|
|
{
|
|
|
lua_pushvalue(L,1); //[1] = object -> [7] = object
|
|
lua_pushvalue(L,1); //[1] = object -> [7] = object
|
|
|
lua_pushvalue(L,2); //[2] = key -> [8] = key
|
|
lua_pushvalue(L,2); //[2] = key -> [8] = key
|
|
|
- lua_pcall(L,2,1,0); //call function at top of stack (__index) -> pop top 2 as args; [7] = return value
|
|
|
|
|
|
|
+ if(lua_pcall(L,2,1,0) != 0) //call function at top of stack (__index) -> pop top 2 as args; [7] = return value
|
|
|
|
|
+ Interpreter::Report(L, String(GetTClassName<T>()).Append(".__index for ").Append(lua_tostring(L,2)).Append(": "));
|
|
|
}
|
|
}
|
|
|
else if(lua_istable(L,-1) )
|
|
else if(lua_istable(L,-1) )
|
|
|
lua_getfield(L,-1,key); //shorthand version of above -> [7] = return value
|
|
lua_getfield(L,-1,key); //shorthand version of above -> [7] = return value
|
|
@@ -253,7 +257,8 @@ int LuaType<T>::newindex(lua_State* L)
|
|
|
{
|
|
{
|
|
|
lua_pushvalue(L,1); //userdata at [7]
|
|
lua_pushvalue(L,1); //userdata at [7]
|
|
|
lua_pushvalue(L,3); //[8] = copy of [3]
|
|
lua_pushvalue(L,3); //[8] = copy of [3]
|
|
|
- lua_pcall(L,2,0,0); //call function, pop 2 off push 0 on
|
|
|
|
|
|
|
+ if(lua_pcall(L,2,0,0) != 0) //call function, pop 2 off push 0 on
|
|
|
|
|
+ Interpreter::Report(L, String(GetTClassName<T>()).Append(".__newindex for ").Append(lua_tostring(L,2)).Append(": "));
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
lua_pop(L,1); //not a setter function.
|
|
lua_pop(L,1); //not a setter function.
|