Original Post
Hey guys, as most of you know, I've chosen Squirrel as my scripting language. However, I'm trying to learn luaplus and squirrel around the same time so I get a good feeling of both, currently I've installed everything and everything seems fine, here's my code: What happens is, it compiles and all, but when I go to run it it asks for the dynamic link library, be it the debug or release (depending on the type of project). I added the static link library in hope of not requiring this library, so I'd like to know what's wrong with this if anyone could please help out. I have the DLL's, I just want to not require them, thanks guys. Squirrel is going great :D
#pragma comment (lib, "LuaPlus_1081.lib")
#include <LuaPlus/LuaPlus.h>
#include <iostream>
using namespace std;
using namespace LuaPlus;
/* Lua test code
*/
static int LS_PrintNumber(LuaState* state)
{
LuaStack args(state);
// Verify it is a number and print it.
if (args[1].IsNumber())
cout << args[1].GetNumber();
printf("%f\n", args[1].GetNumber());
// No return values.
return 0;
}
void test()
{
//Create state
LuaStateOwner state;
//With this the script can access our own C++ functions:
state->GetGlobals().Register("PrintNumber", LS_PrintNumber);
//Open test file:
int iret = state->DoFile("test.lua");
//Get a global variable:
LuaObject sObj = state->GetGlobal("health");
int mytest = sObj.GetInteger();
//Update the value:
sObj.AssignInteger(state, 30);
//Get value again:
mytest = sObj.GetInteger();
//Call a function in lua:
LuaFunction<float> Add = state->GetGlobal("Add");
float myret = Add(3.14f,0.0f);
state->Destroy(state);
}
int main()
{
test();
system("PAUSE");
return 0;
}