1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
diff -Nur celestia-1.4.1.orig/configure.in celestia-1.4.1/configure.in
--- celestia-1.4.1.orig/configure.in 2006-02-03 18:09:54.000000000 +0000
+++ celestia-1.4.1/configure.in 2006-09-19 10:04:57.000000000 +0100
@@ -383,7 +383,7 @@
AC_MSG_CHECKING([whether to enable Celestia Extension Language])
if (test "$enable_lua" != "no"); then
CXXFLAGS="$CXXFLAGS -DCELX"
- LDFLAGS="$LDFLAGS -llualib -llua"
+ LDFLAGS="$LDFLAGS -llua"
if (test "$lua_includes" != "no"); then
CXXFLAGS="$CXXFLAGS -I$lua_includes"
diff -Nur celestia-1.4.1.orig/src/celestia/celx.cpp celestia-1.4.1/src/celestia/celx.cpp
--- celestia-1.4.1.orig/src/celestia/celx.cpp 2006-01-07 00:01:51.000000000 +0000
+++ celestia-1.4.1/src/celestia/celx.cpp 2006-09-19 10:05:06.000000000 +0100
@@ -32,9 +32,7 @@
#include "celx.h"
#include "celestiacore.h"
-extern "C" {
-#include "lualib.h"
-}
+#include "lua.hpp"
using namespace std;
@@ -532,6 +530,8 @@
status = lua_resume(co, narg);
if (status == 0)
+ return 0;
+ else if (status == LUA_YIELD)
{
int nres = lua_gettop(co);
#if 0
@@ -543,7 +543,7 @@
}
else
{
- lua_xmove(co, L, 1); // move error message
+ lua_xmove(co, L, -1); // move error message
return -1; // error flag
}
}
@@ -598,7 +598,7 @@
int stackTop = lua_gettop(costate);
if (strcmp(c_p, "y") == 0)
{
- lua_iolibopen(costate);
+ luaL_openlibs(costate);
ioMode = IOAllowed;
}
else
@@ -713,7 +713,8 @@
// no other errors, and execution terminates normally. There
// should be a better way to figure out whether the script ended
// normally . . .
- if (strcmp(errorMessage, "cannot resume dead coroutine") != 0)
+ if (errorMessage
+ && strcmp(errorMessage, "cannot resume dead coroutine") != 0)
{
cout << "Error: " << errorMessage << '\n';
CelestiaCore* appCore = getAppCore(co);
@@ -4577,10 +4578,7 @@
initMaps();
// Import the base and math libraries
- lua_baselibopen(state);
- lua_mathlibopen(state);
- lua_tablibopen(state);
- lua_strlibopen(state);
+ luaL_openlibs(state);
// Add an easy to use wait function, so that script writers can
// live in ignorance of coroutines. There will probably be a significant
|