LuaFunction -> RegisterLuaFunction

LuaFunction_NoArgs -> LuaFunction
remove RageUtil.h
This commit is contained in:
Glenn Maynard
2005-05-29 02:13:33 +00:00
parent e39fd6110b
commit 68e0b809a6
+7 -8
View File
@@ -2,7 +2,6 @@
#define LUA_FUNCTIONS_H
#include "LuaBinding.h"
#include "RageUtil.h" /* for ssprintf */
extern "C"
{
@@ -14,33 +13,33 @@ extern "C"
#define LUA_RETURN( expr, L ) { LuaHelpers::Push( expr, L ); return 1; }
/* Helpers to create common functions: */
/* Functions that take no arguments: */
#define LuaFunction_NoArgs( func, call ) \
#define LuaFunction( func, call ) \
int LuaFunc_##func( lua_State *L ) { \
LUA_RETURN( call, L ); \
} \
LuaFunction( func ); /* register it */
RegisterLuaFunction( func );
#define LuaFunction_NoArgs LuaFunction /* compat */
#define LuaFunction_Int( func, call ) \
int LuaFunc_##func( lua_State *L ) { \
const int a1 = IArg(1); \
LUA_RETURN( call, L ); \
} \
LuaFunction( func ); /* register it */
RegisterLuaFunction( func );
#define LuaFunction_Float( func, call ) \
int LuaFunc_##func( lua_State *L ) { \
const float a1 = FArg(1); \
LUA_RETURN( call, L ); \
} \
LuaFunction( func ); /* register it */
RegisterLuaFunction( func );
#define LuaFunction_Str( func, call ) \
int LuaFunc_##func( lua_State *L ) { \
CString str = SArg(1); \
LUA_RETURN( call, L ); \
} \
LuaFunction( func ); /* register it */
RegisterLuaFunction( func );
/* Linked list of functions we make available to Lua. */
struct LuaFunctionList
@@ -51,7 +50,7 @@ struct LuaFunctionList
LuaFunctionList *next;
};
extern LuaFunctionList *g_LuaFunctionList;
#define LuaFunction( func ) static LuaFunctionList g_##func( #func, LuaFunc_##func )
#define RegisterLuaFunction( func ) static LuaFunctionList g_##func( #func, LuaFunc_##func )
#endif