[oolua] Strange error in executing code chunk

  • From: Jan Drabner <jan@xxxxxxxxxxx>
  • To: oolua@xxxxxxxxxxxxx
  • Date: Fri, 28 Mar 2014 11:54:02 +0100

Hey,

I have defined a class in OOLUA as follows:

OOLUA_PROXY_CLASS(SoundEffectManager)
    OOLUA_TYPEDEFS
      No_public_constructors
    OOLUA_END_TYPES
OOLUA_MEM_FUNC(void, addEnvironmentEffect, std::string, OOLUA::Lua_table)
OOLUA_CLASS_END

EXPORT_OOLUA_FUNCTIONS_NON_CONST(SoundEffectManager, addEnvironmentEffect)
EXPORT_OOLUA_FUNCTIONS_CONST(SoundEffectManager)

The parameter types are correct.

Now, I am constructing a call to the addEnvironmentEffect function within a C++-function in the following way:
std::string command = "local effectModule = require(\"";
command.append(p_moduleName);
command.append("\")\n Engine.SoundEffectManager:addEnvironmentEffect(\"");
command.append(p_envID);
command.append("\", effectModule)");

Both p_moduleName and p_envID are strings and both are valid (checked at runtime). So in the end I get a script that might look like this:
local effectModule = require("mymod.effects.caveeffect")
Engine.SoundEffectManager:addEnvironmentEffect("Cave", effectModule)

But when this is executed, I get an error in the second line:
Lua error: [string "userChunk"]:2: pulling incorrect type from stack. This is a ref to id 5, stack contains boolean

What is going wrong here?


Other related posts: