Jump to content
  • Advertisement
Sign in to follow this  

luabind::call_function error

This topic is 4319 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

Hi! I have recently started to experiment with LUA 5.1 and luabind. But I have encountered a problem that I can't solve. When I use luabind::call_function to call a lua function with a class as parameter the debugger gives me this error: Unhandled exception at 0x7c812a5b in LuaTest.exe: Microsoft C++ exception: luabind::error at memory location 0x0013fd4c.. Here is some example code that produces the error for me
#include <iostream>

extern "C"
	#include <lua.h>
	#include <lualib.h>
	#include <lauxlib.h>

#include <luabind/luabind.hpp>

class Test

	void Print()
		std::cout << "This is a test" << std::endl;


extern "C" int InitLuabind(lua_State* L)
    using namespace luabind;


		.def("Print", &Test::Print)

    return 0;

int main()
	lua_State *L;
	L = lua_open();



	luaL_loadfile(L, "test.lua");
	Test t;

	luabind::call_function<void>(L, "test", &t); // Call function 'test' with t as parameter


	return 0;

and the content of test.lua...
function test(e)

Is it my code or should this work?

Share this post

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

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!