[Scummvm-cvs-logs] CVS: residual lua.cpp,1.2,1.3

Jonathan Gray khalek at users.sourceforge.net
Sat Aug 16 03:06:02 CEST 2003


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1:/tmp/cvs-serv2786

Modified Files:
	lua.cpp 
Log Message:
stderr/stdin based InputDialog implementation

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- lua.cpp	16 Aug 2003 06:41:37 -0000	1.2
+++ lua.cpp	16 Aug 2003 09:48:53 -0000	1.3
@@ -418,6 +418,17 @@
   act->sayLine(msg);
 }
 
+static void InputDialog() {
+  int c, i = 0;
+  char buf[512];
+  fprintf(stderr, "%s %s: ", luaL_check_string(1), luaL_check_string(2));
+  while (i < 512 && (c = fgetc(stdin)) != EOF && c != '\n')
+    buf[i++] = c;
+  buf[i] = '\0';
+  
+  lua_pushstring(buf);
+}
+
 static void IsMessageGoing() {
   Actor *act;
   if (lua_getparam(1) == LUA_NOOBJECT)
@@ -731,7 +742,6 @@
   "PreRender",
   "MakeSectorActive",
   "GetSectorOppositeEdge",
-  "InputDialog",
   "FileFindDispose",
   "FileFindNext",
   "FileFindFirst",
@@ -1028,7 +1038,8 @@
   { "PerSecond", PerSecond },
   { "EnableControl", EnableControl },
   { "DisableControl", DisableControl },
-  { "GetControlState", GetControlState }
+  { "GetControlState", GetControlState },
+  { "InputDialog", InputDialog }
 };
 
 void register_lua() {





More information about the Scummvm-git-logs mailing list