I don't know if you solved your issues yet, but here is some sample code of how I did it.
extern "C"
{
#include "lualib.h"
#include "lua.h"
#include "lauxlib.h"
}
int VideoPlay(lua_State * L)
{
int argc = lua_gettop(L);
if (argc < 1)
{
// not enough arguments so just return 0
lua_pushnumber(L, 0);
}
else
{
std::string fileName(lua_tostring(L, 1));
char cmdStr[MAX_PATH];
sprintf(cmdStr, "mplayer %s -fs -vo direct3d", fileName.c_str());
system(cmdStr);
lua_pushnumber(L, 1);
}
return 1;
}
// Registering functions
extern "C" int __declspec(dllexport) luaopen_omegacore(lua_State* L)
{
lua_register(L, "ocVideoPlay", VideoPlay);
return 0;
}
package.path = "scriptbank/?.lua;"
require "omegacore"
I hope that helps. One thing I remember is that the method you are using to register functions never seemed to work for me so I used this alternate method.
System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640