added access to global lua variables from lite-c


Click to reveal..
Code:
int i;
	var v;
	STRING* sAuthor = str_create("");
	STRING* sVersion = str_create("");
	
	//GSTScript_SetGlobalString(_str("author"), _str("set author from lite-c")); //uncomment to overwrite the global string author from lite-c
	
	while(1) {
		mouse_pos.x = mouse_cursor.x;
		mouse_pos.y = mouse_cursor.y;
  		wait(1);
 	 	GSTScript_NotifyListener(_str("GSTError"));			// notify an gst standard listener
 	 	GSTScript_GetGlobalInt(_str("gCounter"), i);			// read a global lua int
 	 	GSTScript_GetGlobalVar(_str("gVarCounter"), v);		// read a global lua var
 	 	GSTScript_GetGlobalString(_str("author"), sAuthor);// read a global lua string
 	 	GSTScript_GetGlobalString(_str("version"), sVersion);// read a global lua string
 	 	draw_text(sAuthor,100,300,vector(250,520,520));		//draw strings
 	 	draw_text(sVersion,100,320,vector(250,520,520));
 	 	diag_var("\nlite-c: ELAPSED TIME = %1.5f",i);		//diag lua global numbers
 	 	diag_var("\nlite-c: gVarCounter = %1.5f",v);
 	 	diag("\nlite-c:"); diag(sAuthor);						// diag strings
		GSTScript_SetGlobalInt(_str("gCounter"), i + 1);	// change a global lua int
		GSTScript_SetGlobalVar(_str("gVarCounter"), v + 0.1);	// change a global lua number
 	 	
  }





Andreas
GSTools - Home of
GSTScript 0.9.8: lua scripting for A6/7/8
GSTNet 0.7.9.20: network plugin for A6/7/8
GSTsqlite 1.3.7: sql database plugin for A6/7/8
3DGS Codebase: 57 snippets || 3DGS Downloads: 248 files