Added all callbacks to World.

This commit is contained in:
rude
2009-08-15 14:29:47 +02:00
parent 579f9c75db
commit d4a97d49f3
6 changed files with 174 additions and 97 deletions
+14
View File
@@ -23,6 +23,7 @@
// LOVE
#include "Module.h"
#include "Object.h"
#include "Reference.h"
// STD
#include <iostream>
@@ -53,6 +54,19 @@ namespace love
return 0;
}
Reference * luax_refif(lua_State * L, int type)
{
Reference * r = 0;
// Create a reference only if the test succeeds.
if(lua_type(L, -1) == type)
r = new Reference(L);
else // Pop the value even if it fails (but also if it succeeds).
lua_pop(L, 1);
return r;
}
void luax_printstack(lua_State * L)
{
for(int i = 1;i<=lua_gettop(L);i++)
+9
View File
@@ -35,6 +35,7 @@ namespace love
{
// Forward declarations.
class Module;
class Reference;
/**
* Registries represent special tables which can be accessed with
@@ -68,6 +69,14 @@ namespace love
int value;
};
/**
* Returns a reference to the top stack element (-1) if the value
* is of the specified type. If the value is incorrect, zero is returned.
*
* In any case, the top stack element is popped, regardless of its type.
**/
Reference * luax_refif(lua_State * L, int type);
/**
* Prints the current contents of the stack. Only useful for debugging.
* @param L The Lua state.