# LuaPlus question

## Recommended Posts

supercoder74    154
I have written this code:
#include <stdlib.h>
#include <iostream>
#include <LuaPlus/LuaPlus.h>

using namespace LuaPlus;
using std::cout;
using std::endl;
int main(int argc, char *argv[])
{
LuaStateOwner owner;
owner->DoFile("hello.lua");

LuaFunction<int> fn=owner->GetGlobal("fn");
fn();

system("PAUSE");

return 0;
}


and it gives me this error: 14 C:\Dev-Cpp\luaplustestmain.cpp conversion from LuaPlus::LuaObject' to non-scalar type LuaPlus::LuaFunction<int>' requested. How do I fix this? I know that I could just do something like owner->DoString("fn()"); and just get the return value that way, but is there any differences from calling it from DoString or using LuaFunction<>? Also, are there function pointers in lua? [Edited by - supercoder74 on November 12, 2005 6:26:16 PM]

##### Share on other sites
supercoder74    154
I fixed the one about luafunction. It turns out that the constructor does it!