Commits

Robin Wellner committed e246f0c

[sandbox] Allows stdin/out/err

Comments (0)

Files changed (2)

src/scripts/sandbox.lua

 	-- this is not the same as the list on the Lua users wiki
 	-- mostly because we don't have to worry about the game breaking out
 	-- into the global environment -- this *is* the global environment!
-	io = nil
+	io = {stdin = io.stdin, stdout = io.stdout, stderr = io.stderr}
 	os = {time = os.time} -- for math.randomseed
 	dofile = nil
 	loadfile = nil

src/scripts/sandbox.lua.h

 {
 	0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x5F,
 	0x73,0x61,0x6E,0x64,0x62,0x6F,0x78,0x28,0x29,0x20,0x69,0x6F,0x20,0x3D,0x20,
-	0x6E,0x69,0x6C,0x20,0x6F,0x73,0x20,0x3D,0x20,0x7B,0x74,0x69,0x6D,0x65,0x20,
-	0x3D,0x20,0x6F,0x73,0x2E,0x74,0x69,0x6D,0x65,0x7D,0x20,0x64,0x6F,0x66,0x69,
-	0x6C,0x65,0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,0x6C,0x6F,0x61,0x64,0x66,0x69,
-	0x6C,0x65,0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,0x5F,0x47,0x2E,0x64,0x65,0x62,
-	0x75,0x67,0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,
-	0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x72,0x73,0x20,0x3D,0x20,0x7B,0x70,0x61,
-	0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x72,0x73,0x5B,0x31,
-	0x5D,0x2C,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,
-	0x65,0x72,0x73,0x5B,0x23,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,
-	0x61,0x64,0x65,0x72,0x73,0x5D,0x7D,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,
-	0x2E,0x6C,0x6F,0x61,0x64,0x6C,0x69,0x62,0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,
-	0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x64,0x2E,
-	0x64,0x65,0x62,0x75,0x67,0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,0x70,0x61,0x63,
-	0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x64,0x2E,0x69,0x6F,0x20,
-	0x3D,0x20,0x6E,0x69,0x6C,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,
-	0x6F,0x61,0x64,0x65,0x64,0x2E,0x6F,0x73,0x20,0x3D,0x20,0x6F,0x73,0x0A,0x65,
-	0x6E,0x64,
+	0x7B,0x73,0x74,0x64,0x69,0x6E,0x20,0x3D,0x20,0x69,0x6F,0x2E,0x73,0x74,0x64,
+	0x69,0x6E,0x2C,0x20,0x73,0x74,0x64,0x6F,0x75,0x74,0x20,0x3D,0x20,0x69,0x6F,
+	0x2E,0x73,0x74,0x64,0x6F,0x75,0x74,0x2C,0x20,0x73,0x74,0x64,0x65,0x72,0x72,
+	0x20,0x3D,0x20,0x69,0x6F,0x2E,0x73,0x74,0x64,0x65,0x72,0x72,0x7D,0x20,0x6F,
+	0x73,0x20,0x3D,0x20,0x7B,0x74,0x69,0x6D,0x65,0x20,0x3D,0x20,0x6F,0x73,0x2E,
+	0x74,0x69,0x6D,0x65,0x7D,0x20,0x64,0x6F,0x66,0x69,0x6C,0x65,0x20,0x3D,0x20,
+	0x6E,0x69,0x6C,0x20,0x6C,0x6F,0x61,0x64,0x66,0x69,0x6C,0x65,0x20,0x3D,0x20,
+	0x6E,0x69,0x6C,0x20,0x5F,0x47,0x2E,0x64,0x65,0x62,0x75,0x67,0x20,0x3D,0x20,
+	0x6E,0x69,0x6C,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,
+	0x64,0x65,0x72,0x73,0x20,0x3D,0x20,0x7B,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,
+	0x2E,0x6C,0x6F,0x61,0x64,0x65,0x72,0x73,0x5B,0x31,0x5D,0x2C,0x20,0x70,0x61,
+	0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x72,0x73,0x5B,0x23,
+	0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x72,0x73,
+	0x5D,0x7D,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,
+	0x6C,0x69,0x62,0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,0x70,0x61,0x63,0x6B,0x61,
+	0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x64,0x2E,0x64,0x65,0x62,0x75,0x67,
+	0x20,0x3D,0x20,0x6E,0x69,0x6C,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,
+	0x6C,0x6F,0x61,0x64,0x65,0x64,0x2E,0x69,0x6F,0x20,0x3D,0x20,0x6E,0x69,0x6C,
+	0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x2E,0x6C,0x6F,0x61,0x64,0x65,0x64,
+	0x2E,0x6F,0x73,0x20,0x3D,0x20,0x6F,0x73,0x0A,0x65,0x6E,0x64,
 };
 // [/sandbox.lua]