[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lua-l
Subject:    re: using ints in lua 5.1w6
From:       Terisquas Brothers <terisquas () yahoo ! co ! uk>
Date:       2005-06-26 8:42:56
Message-ID: 20050626084257.11425.qmail () web26407 ! mail ! ukl ! yahoo ! com
[Download RAW message or body]

thanks for the pointer on using ints in lua 5.1w6 :)


> Also a little question, I'm starting with lua and
from
> time to time I'm crashing the lua vm after quite a
> number of operations.

>You'll have to provide us with more details. Ideally,
>a simple test program
>that can reproduce the problem.


I have been able to reproduce it in a little example,
the problem was that I was popping information from
the stack despite the previous lua code execution
failed (so I suppose I was popping without results
being pushed to the stack)


in my computer crashes always at iteration 25  (using
msvc 6, lua 5.0),as long as Luaexec call fails for any
reason (i.e. GenericObject not found, stand being
null, ....)



		
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
["luacr.cpp" (application/octet-stream)]

extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
extern lua_State *luaState;


void Luainit (void)
{
	luaState=lua_open();
	luaopen_base (luaState);
	luaopen_string (luaState);
	luaopen_table (luaState);
	luaopen_io (luaState); // debug
}


int Luaexec (int returnParams,char *pstring)
{
static int execNum=0;
int error;
char id[32];


	sprintf (id,"exec%d",execNum++);
	
	error=luaL_loadbuffer (luaState,pstring,strlen(pstring),id);
	if (error) 
	{
//		strcpy (luaErrorMsg,lua_tostring (luaState,-1));
		lua_pop (luaState,1);
		return 0;
	}
	
	error=lua_pcall (luaState,0,returnParams,0);
	if (error) 
	{
//		strcpy (luaErrorMsg,lua_tostring (luaState,-1));
		lua_pop (luaState,1);
		return 0;
	}

	return 1;
}




void crashLua (void)
{
	// initialization
	Luainit ();
	int cnt=0;
	int rv;
	while (1)
	{
		Luaexec (1,"return GenericObject.anim.stand[1][1].rpy");
		rv=Lua::getReturnInteger();
		cnt++;
	}

}



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic