Lua: warn when memory.register* function is called, although it's not available.

This commit is contained in:
gocha 2010-08-15 02:56:14 +00:00
parent e28f34a6d9
commit 7fab839c75
1 changed files with 9 additions and 0 deletions

View File

@ -275,14 +275,23 @@ LuaMemHookType MatchHookTypeToCPU(lua_State* L, LuaMemHookType hookType)
DEFINE_LUA_FUNCTION(memory_registerwrite, "address,[size=1,][cpuname=\"main\",]func") DEFINE_LUA_FUNCTION(memory_registerwrite, "address,[size=1,][cpuname=\"main\",]func")
{ {
#ifndef HAVE_LUA
luaL_error(L, "memory.registerwrite failed: function is not available in this build.");
#endif
return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_WRITE), 1); return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_WRITE), 1);
} }
DEFINE_LUA_FUNCTION(memory_registerread, "address,[size=1,][cpuname=\"main\",]func") DEFINE_LUA_FUNCTION(memory_registerread, "address,[size=1,][cpuname=\"main\",]func")
{ {
#ifndef HAVE_LUA
luaL_error(L, "memory.registerread failed: function is not available in this build.");
#endif
return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_READ), 1); return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_READ), 1);
} }
DEFINE_LUA_FUNCTION(memory_registerexec, "address,[size=2,][cpuname=\"main\",]func") DEFINE_LUA_FUNCTION(memory_registerexec, "address,[size=2,][cpuname=\"main\",]func")
{ {
#ifndef HAVE_LUA
luaL_error(L, "memory.registerexec failed: function is not available in this build.");
#endif
return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_EXEC), 2); return memory_registerHook(L, MatchHookTypeToCPU(L,LUAMEMHOOK_EXEC), 2);
} }