#include <stdio.h>
extern "C"
{
#include <lua.h>
#include <lualib.h>
}
int main(int argc, char* argv[ ])
{
lua_State* luaVM = lua_open(0);
if (NULL == luaVM)
{
printf("Error Initializing lua\n");
return -1;
}
// initialize lua standard library functions
lua_baselibopen(luaVM);
lua_iolibopen(luaVM);
lua_strlibopen(luaVM);
lua_mathlibopen(luaVM);
// Do stuff with lua code.
char* strLuaInput = "a = 1 + 1;\nprint( a);\n";
lua_dostring(luaVM, strLuaInput);
lua_close(luaVM);
while(1) {}
return 0;
}
Stupid LUA problem
I am attempting to embed LUA into a simple console application. I downloaded the compiled library and dlls from this website:
http://tonyandpaige.com/tutorials/lua1.html
I then used the code from the article here on gamedev:
However the program crashes on the first line (the lua_open call)... any ideas?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement