Jump to content
  • Advertisement
Sign in to follow this  
assainator

lua & C++ problem

This topic is 3212 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

heey all, i've tried to embed lua into C++. i'm using this code:
extern "C" {   
#include "lua.h"   
#include "lualib.h"   
#include "lauxlib.h"   
}
#include <stdio.h>
 
int main()   
{   
	int s=0;   
	
	lua_State *L = lua_open();   
	
	luaopen_base(L);
	luaopen_table(L);
	luaopen_io(L);
	luaopen_string(L);
	luaopen_math(L);

	//run a Lua scrip here   
	luaL_dofile(L, "lua/startup.lua");   

	printf("\nI am done with Lua in C++.\n");   

	lua_close(L);   

}

but when i run it i get this error:
Quote:
PANIC: unprotected error in call to Lua API (no calling environment)
any idea's how to solve this error? i'm using: Visual C++ 2008 lua 5.1.4 i'm linking to: lua5.1.lib

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!