sfz_scripting.cpp

Go to the documentation of this file.
00001 #include "lugre_prefix.h"
00002 #include <assert.h>
00003 #include <stdarg.h>
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include "lugre_scripting.h"
00007 #include "lugre_luabind.h"
00008 
00009 #include "object.h"
00010 #include "location.h"
00011 #include "resyncreceiver.h"
00012 #include "objectcontroller.h"
00013 
00014 using namespace Lugre;
00015 
00016 static int l_GetDataDir         (lua_State *L) { PROFILE lua_pushstring(L,(DATA_DIR)    ); return 1; }
00017 static int l_GetLuaDir          (lua_State *L) { PROFILE lua_pushstring(L,(LUA_DIR)     ); return 1; }
00018 static int l_GetLugreDir        (lua_State *L) { PROFILE lua_pushstring(L,(LUGRE_DIR)   ); return 1; }
00019 static int l_UseHomeWritable    (lua_State *L) { PROFILE 
00020     #ifdef USE_HOME_WRITABLE
00021     lua_pushboolean(L,true); 
00022     #else
00023     lua_pushboolean(L,false); 
00024     #endif
00025     return 1; 
00026 }
00027 
00028 void    SFZ_RegisterLuaPlugin   () {
00029     
00030     class cSFZ_ScriptingPlugin : public cScriptingPlugin { public:
00031         void    RegisterLua_GlobalFunctions (lua_State* L) {
00032             lua_register(L,"GetDataDir",        l_GetDataDir); 
00033             lua_register(L,"GetLuaDir",         l_GetLuaDir); 
00034             lua_register(L,"GetLugreDir",       l_GetLugreDir); 
00035             lua_register(L,"UseHomeWritable",   l_UseHomeWritable); 
00036         }
00037         
00038         void    RegisterLua_Classes         (lua_State* L) {
00039             cObject::LuaRegister(L);
00040             cLocation::LuaRegister(L);
00041             cObjectController::LuaRegister(L);
00042             cResyncReceiver::LuaRegister(L);
00043         }
00044     };
00045     
00046     cScripting::RegisterPlugin(new cSFZ_ScriptingPlugin());
00047 }

Generated on Wed May 23 06:00:15 2012 for cpp by  doxygen 1.5.6