when i follow the tutorial at http://gamedevgeek.com/tutorials/gettin ... d-with-lua with vc++ express, i can compile the program without errors but when i execute the program from the ide the lua script doesn't run.
on the other hand, when i go to the debug folder where the exe is and run the exe, the lua script runs.
so my question is... why doesnt the lua script run when i execute the program from the ide?
ps: this is my first time posting in this community so ... um ... hi ^_^
vc++ express with lua
Moderator: Coders of Rage
- Kros
- Chaos Rift Regular
- Posts: 136
- Joined: Tue Feb 24, 2009 4:01 pm
- Current Project: N/A
- Favorite Gaming Platforms: PC, Playstation/2/3
- Programming Language of Choice: C++
- Location: Oregon,USA
- Contact:
Re: vc++ express with lua
Firstly, welcome to the boards, glad to have you here.Mr.Clean wrote:when i follow the tutorial at http://gamedevgeek.com/tutorials/gettin ... d-with-lua with vc++ express, i can compile the program without errors but when i execute the program from the ide the lua script doesn't run.
on the other hand, when i go to the debug folder where the exe is and run the exe, the lua script runs.
so my question is... why doesnt the lua script run when i execute the program from the ide?
ps: this is my first time posting in this community so ... um ... hi ^_^
Second, could you be more specific with what happens when you run from VS? If the script doesn't run, then what does happen?
YouTube ChannelIsaac Asimov wrote:Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.
Re: vc++ express with lua
the rest of the code runs but not the script. for example, in the case of the tutorial from the link above, the output should be:If the script doesn't run, then what does happen?
hello world
press enter to exit
but instead i just get:
press enter to exit
- Kros
- Chaos Rift Regular
- Posts: 136
- Joined: Tue Feb 24, 2009 4:01 pm
- Current Project: N/A
- Favorite Gaming Platforms: PC, Playstation/2/3
- Programming Language of Choice: C++
- Location: Oregon,USA
- Contact:
Re: vc++ express with lua
Try replacing your main with this. luaL_dofile() should return 0 if theres no issues with the script, if there is it'll return 1. Might be encountering an error with your script and you wouldn't even know it.
Edit: Forgot that you successfully ran it from the debug folder; I'd give the above a shot anyway but, I doubt that's the problem. I'm out of ideas. Someone else with more lua integration experience might be able to shed some light on the issue.
source: http://www.nabble.com/Reporting-error-m ... 47566.html
Code: Select all
int main ( int argc, char *argv[] )
{
/* initialize Lua */
L = lua_open();
/* load Lua base libraries */
luaL_openlibs(L);
/* run the script */
if(luaL_dofile(L, "test.lua") == 1)
{
printf("Error: %s\n",lua_tostring(L,-1));
getchar();
return 1;
}
/* cleanup Lua */
lua_close(L);
/* pause */
printf( "Press enter to exit..." );
getchar();
return 0;
}
source: http://www.nabble.com/Reporting-error-m ... 47566.html
YouTube ChannelIsaac Asimov wrote:Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.
Re: vc++ express with lua
yep, got an error message:
Error: cannot open test.lua: No such file or directory
which i think means ... the ide is looking for the script in a directory that isn't in the debug folder?
Error: cannot open test.lua: No such file or directory
which i think means ... the ide is looking for the script in a directory that isn't in the debug folder?
- Kros
- Chaos Rift Regular
- Posts: 136
- Joined: Tue Feb 24, 2009 4:01 pm
- Current Project: N/A
- Favorite Gaming Platforms: PC, Playstation/2/3
- Programming Language of Choice: C++
- Location: Oregon,USA
- Contact:
Re: vc++ express with lua
Correct. Put the .lua file where the code files are located.Mr.Clean wrote:yep, got an error message:
Error: cannot open test.lua: No such file or directory
which i think means ... the ide is looking for the script in a directory that ins't in the debug folder?
YouTube ChannelIsaac Asimov wrote:Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.
Re: vc++ express with lua
Mr.Clean hugs Kros and says, thank you kind sir
- MarauderIIC
- Respected Programmer
- Posts: 3406
- Joined: Sat Jul 10, 2004 3:05 pm
- Location: Maryland, USA
Re: vc++ express with lua
BTW you can put them in whatever folder you want as long as you change your project's working directory settings. Same with all external files :)
Oh yes, and welcome to the forums.
Oh yes, and welcome to the forums.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.