mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
Added all callbacks to World.
This commit is contained in:
@@ -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++)
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user