Bug 1071558 - Lua 5.2 breaks some xmoto levels
Summary: Lua 5.2 breaks some xmoto levels
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: xmoto
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Gwyn Ciesla
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-01 17:29 UTC by Conrad Meyer
Modified: 2014-04-14 22:34 UTC (History)
1 user (show)

Fixed In Version: xmoto-0.5.11-1.fc20
Clone Of:
Environment:
Last Closed: 2014-04-14 22:34:28 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Conrad Meyer 2014-03-01 17:29:52 UTC
Several levels:

0a770ba9bf9430b7d726aac35032c35el1584.blv  (Aroundtheworld)
1295de159978a1b5ee763212c68761ael439.blv
2b9ee12d9f0c983878071da6aca23d00l3348.blv
2b9ee12d9f0c983878071da6aca23d00l3348.blv
2e5239815cd7144063e25bd2a05ed2bdl184.blv
2e5239815cd7144063e25bd2a05ed2bdl184.blv
369abc0096183e7af4ed74694661795bl9055.blv
369abc0096183e7af4ed74694661795bl9055.blv
6f4542e872149d7764db0198627c42bdl409.blv
74c293ec8adb95a575dbf318cc93c88el631.blv
79ac0f2d7444b86b7beeaab42b8b4589l1423.blv
b579c4f066795018279bf8ccc9c5a477l7545.blv  (timzescemetery)

Use 'math.mod()' in their scripts. Since math.mod() is no longer supported in Lua 5.2, these levels are unplayable in Fedora with Lua 5.2. The replacement is maybe math.fmod() (unclear to me, I am unfamiliar with Lua).

Suggest: Automatically translating scripts? Or adding a compatibility mod() function to math module in xmoto (not sure if Lua can do this)?

Tried to file this upstream, but got a 500 error from their bug tracker.

Comment 1 Conrad Meyer 2014-03-02 16:24:47 UTC
Semi-unrelated, I'm also seeing:

failed to load level encapsulated script:
[string ""]:4: attempt to index global 'math' (a nil value)

which is coming from xmscene/Scene.cpp:
 592       try {
 593         m_luaGame->loadScript(m_pLevelSrc->scriptSource(), m_pLevelSrc->scriptFileName());
 594       } catch(Exception &e) {
 595         std::string error_msg = m_luaGame->getErrorMsg();
 596         throw Exception("failed to load level encapsulated script :\n" + error_msg);
 597       }


Given loadScript looks like this:
214
215   nRet = luaL_loadbuffer(m_pL, i_scriptCode.c_str(), i_scriptCode.length(),
216                          i_scriptFilename.c_str()) || lua_pcall(m_pL, 0, 0, 0);
217
218   /* Returned WHAT? */
219   if(nRet != 0) {
220     throw Exception("failed to load level script");
221   }


The exception is likely coming from luaL_loadbuffer() -- I wonder if the 'math' module is available at load time (regression?).

Comment 2 Conrad Meyer 2014-03-02 21:44:24 UTC
Oh, I misread. The message goes from m_luaGame::getErrorMsg(), not the exception.

My mistake.

Comment 3 Conrad Meyer 2014-03-02 21:58:49 UTC
Here's a problematic level: "the Curse Of the Twelwe Stonemen" (yes that is how it is spelled).

"failed to invoke (bool) OnLoad(): [string ""]:35: attempt to index global 'math' (a nil value)"

Another one: "Magic_Bunny - Scripted" (similar error message, but line/col ":3:").


Some of are failures which list the level name. The level "memoryingame" doesn't even do that (I attached with gdb and break on LuaLibGame::getErrorMsg; go up two frames and look at this->m_idlevel).

From "memoryingame" (l8023): "[string ""]:89: attempt to index global 'table' (a nil value)

From memoryingame's level file[0]:

    function OnLoad()
    ...
    --randomize!
    for i=1,100,1 do sprites=table.shuffle(sprites) end --random arrange!
    ...
    return true
    end


This used to work...

[0]: https://github.com/MichaelHoste/xmoto/blob/master/data/Levels/l8023.lvl

Comment 4 Gwyn Ciesla 2014-03-28 14:22:08 UTC
I'm trying to build this against compat-lua-devel, which is 5.1, and I get this:

states/../LuaLibGame.h:113:31: error: 'lua_State' has not been declared
   static int L_Game_StopTimer(lua_State *pL);


I'll file an upstream bug to support 5.2.

Comment 5 Gwyn Ciesla 2014-03-28 14:24:28 UTC
https://sourceforge.net/p/xmoto/bugs/64/

Comment 6 Gwyn Ciesla 2014-03-28 15:05:19 UTC
I've got this working now, and it works on 'the Curse Of the Twelwe Stonemen'.

Update coming.

Comment 7 Gwyn Ciesla 2014-03-28 15:16:57 UTC
It built for me but not in koji. . .working on it. :(

Comment 8 Conrad Meyer 2014-03-28 15:45:01 UTC
Thanks for working on this. I know it's a *sooper* important bug ;)

Comment 9 Fedora Update System 2014-03-28 18:35:50 UTC
xmoto-0.5.10-9.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/xmoto-0.5.10-9.fc20

Comment 10 Fedora Update System 2014-03-30 06:11:51 UTC
Package xmoto-0.5.10-9.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing xmoto-0.5.10-9.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4512/xmoto-0.5.10-9.fc20
then log in and leave karma (feedback).

Comment 11 Conrad Meyer 2014-03-30 12:33:20 UTC
Looks good to me, I left karma on bodhi. Thanks, Jon.

Comment 12 Fedora Update System 2014-04-02 09:02:14 UTC
Package xmoto-0.5.11-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing xmoto-0.5.11-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-4512/xmoto-0.5.11-1.fc20
then log in and leave karma (feedback).

Comment 13 Fedora Update System 2014-04-14 22:34:28 UTC
xmoto-0.5.11-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.