diff -ru StepMania-3.9-src/autoconf/m4/lua.m4 StepMania-3.9-src+pasky/autoconf/m4/lua.m4
--- StepMania-3.9-src/autoconf/m4/lua.m4	2005-01-12 15:23:23.000000000 +0100
+++ StepMania-3.9-src+pasky/autoconf/m4/lua.m4	2007-08-06 22:57:04.000000000 +0200
@@ -8,7 +8,7 @@
 	old_LIBS=$LIBS
 	LIBS="$LIBS $LUA_LIBS"
 	
-	AC_CHECK_FUNC(lua_open, , LUA_MISSING=yes)
+	AC_CHECK_FUNC(lua_newstate, , LUA_MISSING=yes)
 
 	# If lua-config exists, we should at least have Lua; if it fails to build,
 	# something other than it not being installed is wrong.
@@ -23,10 +23,10 @@
 	LIBS="$old_LIBS"
 else
 	if test "$LIB_LUA" = ""; then
-		AC_CHECK_LIB(lua, lua_open, LIB_LUA=-llua)
+		AC_CHECK_LIB(lua, lua_newstate, LIB_LUA=-llua)
 	fi
 	if test "$LIB_LUA" = ""; then
-		AC_CHECK_LIB(lua50, lua_open, LIB_LUA=-llua50)
+		AC_CHECK_LIB(lua50, lua_newstate, LIB_LUA=-llua50)
 	fi
 	if test "$LIB_LUA_LIB" = ""; then
 		AC_CHECK_LIB(lualib, luaopen_base, LIB_LUA_LIB=-llualib, , [$LIB_LUA -ldl])
diff -ru StepMania-3.9-src/configure StepMania-3.9-src+pasky/configure
--- StepMania-3.9-src/configure	2005-11-03 16:27:02.000000000 +0100
+++ StepMania-3.9-src+pasky/configure	2007-08-06 22:58:42.000000000 +0200
@@ -5723,9 +5723,9 @@
 	LUA_LIBS=`$LUA_CONFIG --static`
 else
 	if test "$LIB_LUA" = ""; then
-		echo "$as_me:$LINENO: checking for lua_open in -llua" >&5
-echo $ECHO_N "checking for lua_open in -llua... $ECHO_C" >&6
-if test "${ac_cv_lib_lua_lua_open+set}" = set; then
+		echo "$as_me:$LINENO: checking for lua_newstate in -llua" >&5
+echo $ECHO_N "checking for lua_newstate in -llua... $ECHO_C" >&6
+if test "${ac_cv_lib_lua_lua_newstate+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -5743,11 +5743,11 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char lua_open ();
+char lua_newstate ();
 int
 main ()
 {
-lua_open ();
+lua_newstate ();
   ;
   return 0;
 }
@@ -5773,28 +5773,28 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_lua_lua_open=yes
+  ac_cv_lib_lua_lua_newstate=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_lua_lua_open=no
+ac_cv_lib_lua_lua_newstate=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_lua_lua_open" >&5
-echo "${ECHO_T}$ac_cv_lib_lua_lua_open" >&6
-if test $ac_cv_lib_lua_lua_open = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_lua_lua_newstate" >&5
+echo "${ECHO_T}$ac_cv_lib_lua_lua_newstate" >&6
+if test $ac_cv_lib_lua_lua_newstate = yes; then
   LIB_LUA=-llua
 fi
 
 	fi
 	if test "$LIB_LUA" = ""; then
-		echo "$as_me:$LINENO: checking for lua_open in -llua50" >&5
-echo $ECHO_N "checking for lua_open in -llua50... $ECHO_C" >&6
-if test "${ac_cv_lib_lua50_lua_open+set}" = set; then
+		echo "$as_me:$LINENO: checking for lua_newstate in -llua50" >&5
+echo $ECHO_N "checking for lua_newstate in -llua50... $ECHO_C" >&6
+if test "${ac_cv_lib_lua50_lua_newstate+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -5812,11 +5812,11 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char lua_open ();
+char lua_newstate ();
 int
 main ()
 {
-lua_open ();
+lua_newstate ();
   ;
   return 0;
 }
@@ -5842,20 +5842,20 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_lua50_lua_open=yes
+  ac_cv_lib_lua50_lua_newstate=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_lua50_lua_open=no
+ac_cv_lib_lua50_lua_newstate=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_lua50_lua_open" >&5
-echo "${ECHO_T}$ac_cv_lib_lua50_lua_open" >&6
-if test $ac_cv_lib_lua50_lua_open = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_lua50_lua_newstate" >&5
+echo "${ECHO_T}$ac_cv_lib_lua50_lua_newstate" >&6
+if test $ac_cv_lib_lua50_lua_newstate = yes; then
   LIB_LUA=-llua50
 fi
 
@@ -5867,7 +5867,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-llualib $LIB_LUA -ldl $LIBS"
+LIBS="-llua $LIB_LUA -ldl $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5925,7 +5925,7 @@
 echo "$as_me:$LINENO: result: $ac_cv_lib_lualib_luaopen_base" >&5
 echo "${ECHO_T}$ac_cv_lib_lualib_luaopen_base" >&6
 if test $ac_cv_lib_lualib_luaopen_base = yes; then
-  LIB_LUA_LIB=-llualib
+  LIB_LUA_LIB=-llua
 fi
 
 	fi
diff -ru StepMania-3.9-src/src/LuaHelpers.cpp StepMania-3.9-src+pasky/src/LuaHelpers.cpp
--- StepMania-3.9-src/src/LuaHelpers.cpp	2004-08-29 02:28:28.000000000 +0200
+++ StepMania-3.9-src+pasky/src/LuaHelpers.cpp	2007-08-07 00:39:19.000000000 +0200
@@ -129,6 +129,10 @@
 	longjmp( jbuf, 1 );
 }
 
+extern "C" {
+extern lua_State *luaL_newstate (void);
+}
+
 bool Lua::RunExpression( const CString &str )
 {
 try {
