• Create Account

### #Actualfalconmick

Posted 06 April 2012 - 01:36 AM

for instance... I cannot find a way in hell to fix this error:

CompCompiler.cpp
1>g:\crsm-svn\luatesting\externallibraries\include\luabind\detail\call.hpp(293): error C2027: use of undefined type 'lua_State'
1>		  g:\crsm-svn\luatesting\externallibraries\include\lua.h(50) : see declaration of 'lua_State'
1>		  g:\crsm-svn\luatesting\externallibraries\include\luabind\detail\call.hpp(89) : see reference to function template instantiation 'int luabind::detail::invoke_normal<F,boost::mpl::vector3<T0,T1,T2>,Policies>(lua_State *,const luabind::detail::function_object &,luabind::detail::invoke_context &,const F &,Signature,const Policies &,boost::mpl::long_<N>,boost::mpl::true_)' being compiled
1>		  with
1>		  [
1>			  F=luabind::detail::construct<construct_type,pointer,signature>,
1>			  T0=void,
1>			  T2=lua_State,
1>			  Policies=luabind::detail::null_type,
1>			  N=2
1>		  ]
.........
........

which is being caused by this class:
#pragma once

#include <lua.hpp>
#include <luabind/luabind.hpp>

class CompCompiler
{
public:
CompCompiler();
~CompCompiler();
void setSomeData(int dataz);
void setMoreData(bool statezzz);
int getSomeData(){return(someData);};
bool getMoreData(){return(moreData);};
void setupLuaBinds(lua_State *L);
private:
int someData;
bool moreData;
};

implementation:
#include "CompCompiler.h"

CompCompiler::CompCompiler()
{
someData = 2;

moreData = true;
}

void CompCompiler::setupLuaBinds(lua_State *L)
{
luaL_openlibs(L);
luabind::open(L);

luabind::module(L)
[
luabind::class_<CompCompiler>("CompCompiler")
.def(luabind::constructor<lua_State>())
.def("setSomeData",&CompCompiler::setSomeData)
.def("setMoreData", &CompCompiler::setMoreData)
.def("getSomeData", &CompCompiler::getSomeData)
.def("getMoreData", &CompCompiler::getMoreData)
];

lua_close(L);
}

CompCompiler::~CompCompiler()
{
}


Now, the reason why I am getting this error is probably something trivial.. but as I have no knowledge in luabind I am hitting a brick wall.

I thought, hey maybe it's because inside of a constructor lua_state is unacceptable for some stupid reason, bummer, now my neat idea ain't gonna be as need as I wanted it to be, but when I changed my code (to what you see there) so that lua_state wasn't in the compiler, it was in a fully compiled class, it still gets the error -.-
so apparently atm luabind is angry at me for passing a lua_state... can you even pass a lua_state?

So I am stuck at a brick wall... I am trying to keep my LuaInstances class as abstract as possible (i.e. all it does is hold and distribute the states, the classes using them initiate their part in a given instance (yes I know, if I wanted to be fully abstract I would make a separate class for initiating the class being binded to luabind, but I can't be bothered) can you not do this?

I am trying to make it so that there are multiple instances of lua_state so that I can keep my lua states COMPLETLY seperate so that when who ever is writing the scripts, is writing the scripts, they only have access to a portion of the functions in my code for a given task.. I don't want somone who is changing key bindings having access to entity management -.-.. I considered namespaces, but people would (to the best of my knowledge) be able to access the functions/globals I don't want them having access to.

### #1falconmick

Posted 06 April 2012 - 01:35 AM

for instance... I cannot find a way in hell to fix this error:

CompCompiler.cpp
1>g:\crsm-svn\luatesting\externallibraries\include\luabind\detail\call.hpp(293): error C2027: use of undefined type 'lua_State'
1>          g:\crsm-svn\luatesting\externallibraries\include\lua.h(50) : see declaration of 'lua_State'
1>          g:\crsm-svn\luatesting\externallibraries\include\luabind\detail\call.hpp(89) : see reference to function template instantiation 'int luabind::detail::invoke_normal<F,boost::mpl::vector3<T0,T1,T2>,Policies>(lua_State *,const luabind::detail::function_object &,luabind::detail::invoke_context &,const F &,Signature,const Policies &,boost::mpl::long_<N>,boost::mpl::true_)' being compiled
1>          with
1>          [
1>              F=luabind::detail::construct<construct_type,pointer,signature>,
1>              T0=void,
1>              T2=lua_State,
1>              Policies=luabind::detail::null_type,
1>              N=2
1>          ]
.........
........

which is being caused by this class:
#pragma once

#include <lua.hpp>
#include <luabind/luabind.hpp>

class CompCompiler
{
public:
CompCompiler();
~CompCompiler();
void setSomeData(int dataz);
void setMoreData(bool statezzz);
int getSomeData(){return(someData);};
bool getMoreData(){return(moreData);};
void setupLuaBinds(lua_State *L);
private:
int someData;
bool moreData;
};

implementation:
[code#include "CompCompiler.h"

CompCompiler::CompCompiler()
{
someData = 2;

moreData = true;
}

void CompCompiler::setupLuaBinds(lua_State *L)
{
luaL_openlibs(L);
luabind::open(L);

luabind::module(L)
[
luabind::class_<CompCompiler>("CompCompiler")
.def(luabind::constructor<lua_State>())
.def("setSomeData",&CompCompiler::setSomeData)
.def("setMoreData", &CompCompiler::setMoreData)
.def("getSomeData", &CompCompiler::getSomeData)
.def("getMoreData", &CompCompiler::getMoreData)
];

lua_close(L);
}

CompCompiler::~CompCompiler()
{
}
[/code]

Now, the reason why I am getting this error is probably something trivial.. but as I have no knowledge in luabind I am hitting a brick wall.

I thought, hey maybe it's because inside of a constructor lua_state is unacceptable for some stupid reason, bummer, now my neat idea ain't gonna be as need as I wanted it to be, but when I changed my code (to what you see there) so that lua_state wasn't in the compiler, it was in a fully compiled class, it still gets the error -.-
so apparently atm luabind is angry at me for passing a lua_state... can you even pass a lua_state?

So I am stuck at a brick wall... I am trying to keep my LuaInstances class as abstract as possible (i.e. all it does is hold and distribute the states, the classes using them initiate their part in a given instance (yes I know, if I wanted to be fully abstract I would make a separate class for initiating the class being binded to luabind, but I can't be bothered) can you not do this?

I am trying to make it so that there are multiple instances of lua_state so that I can keep my lua states COMPLETLY seperate so that when who ever is writing the scripts, is writing the scripts, they only have access to a portion of the functions in my code for a given task.. I don't want somone who is changing key bindings having access to entity management -.-.. I considered namespaces, but people would (to the best of my knowledge) be able to access the functions/globals I don't want them having access to.

PARTNERS