   A problem with SDL and Lua.
  Hi, everyone.    I am writing a program with Lua and SDL.They are Lua5.1 and SDL 1.3.    My problem is: when I call the "SDL_SetVideoMode" function to get SDL_Surface, the "luagetstring" function will make an error at lua_call(L, 1, 1); If I write "lua_pcall(L,1,1,0);" instead of lua_call(L, 1, 1), there is the same result. But if the SDL_SetVideoMode not execute, there is no problem. I will get the right result by calling luagetstring(L, 1,str );    Is it a conflict between SDL with Lua? Or is there anything I missed?There is my sourcecode and the lua script.===========================================================data.luawndres = {{ type = "tga", x = 100, y = 200, width = 0, height = 0},{ type = "tga", x = 100, y = 200, width = 0, height = 0},}testfromlua.luafunction add ( x )return wndres[x].xendfunction gettablelen()return #wndres endfunction getwndtype( idx )return wndres[idx].typeendfunction getX( idx )return wndres[idx].xendfunction getY( idx )return wndres[idx].yend============================================================// testnewlua.cpp : Defines the entry point for the console application.//#include "SDL/SDL.h"#include "SDL/SDL_image.h"extern "C"{#include "lua.h"#include "lauxlib.h"#include "lualib.h"}#include <iostream>#include <string>static void luagetstring(lua_State *L, int idx, std::string& str ){lua_getglobal(L,"getwndtype");;lua_pushnumber(L, idx);lua_call(L, 1, 1);size_t number = 0;str = lua_tolstring(L, -1,&number);lua_pop(L, 1);}int main(int argc, char* args[]){lua_State *L;L = luaL_newstate();luaL_openlibs(L);int base = lua_gettop(L) - 0;std::string t;luaL_loadfile(L, "data.lua") || lua_pcall(L, 0, 1,base);luaL_loadfile(L, "testfromlua.lua") || lua_pcall(L, 0, 1,base);if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )    {   return false;    }    //Set up the screen    SDL_Surface* g_pScreen = SDL_SetVideoMode( 300, 300, 32, SDL_SWSURFACE );for( size_t i = 0; i < 2; i++ ){std::string str = "";luagetstring(L, 1,str );}return 0;}=========================================================   