|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| lua & C++ problem |
|
![]() assainator Member since: 7/12/2009 |
||||
|
|
||||
| heey all, i've tried to embed lua into C++. i'm using this code: extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" } #include <stdio.h> int main() { int s=0; lua_State *L = lua_open(); luaopen_base(L); luaopen_table(L); luaopen_io(L); luaopen_string(L); luaopen_math(L); //run a Lua scrip here luaL_dofile(L, "lua/startup.lua"); printf("\nI am done with Lua in C++.\n"); lua_close(L); } but when i run it i get this error: Quote: any idea's how to solve this error? i'm using: Visual C++ 2008 lua 5.1.4 i'm linking to: lua5.1.lib |
||||
|
||||
![]() Winegums Member since: 12/21/2005 From: Watford, United Kingdom |
||||
|
|
||||
| I don't know much about lua but...try calling luaL_openlibs(L); before luaopen_base(L); etc. |
||||
|
||||
![]() assainator Member since: 7/12/2009 |
||||
|
|
||||
| thanks for the advice but it didn't help. assainator |
||||
|
||||
![]() Atrix256 Member since: 4/28/2009 From: Seattle, WA, United States |
||||
|
|
||||
| maybe it can't find the file. try doing an fopen to that filename and seeing if it succeeds maybe? |
||||
|
||||
![]() mattd Member since: 2/26/2000 |
||||
|
|
||||
| Check the first point of this. Try replacing all your luaopen_* calls with just one to luaL_openlibs. |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|