You are not logged in.

Read the FAQ and Knowledge Base before posting.
WiFi not emulated and not supported!!
We won't make a 3DS/2DS emulator.

#1 2011-04-19 19:21:02

Registered: 2011-03-25
Posts: 2

[solved] 0.9.7 and Lua

I have massive problems with Lua-scripting since 0.9.7.
I'm using the binaries from Sourceforge, on win7 (32bit).
For example, this just makes 0.9.7 crash, but works in 0.9.6 (there's no error message, just the generic windows "application crashed" popup):

local function main()
  gui.text(0, 0, 'hi.')


I can't even print the available function-names into a file (makes Desmume crash):

local f ='out.txt', 'wb')
f:write(tostring(package.loaded), '\n')

tostring works on pretty much anything else, though- its very strange...


pcall(tostring, package.loaded)

crashes, too, so i guess the problem is on the C side of things.

I'd test this with the SVN-head, but I probably couldn't compile it anyway since I have no Visual Studio installed and abysmally slow inet (<56k -.-).
If there is any chance i can get this to compile under gcc/mingw during an afternoon or so, please tell me, and I'll try wink

PS: Could anyone kindly point me to any source of documentation/ressources for scripting Desmume (function reference, examples, ...)?

--edit: I guess i found the problem... Lua is linked dynamically since 0.9.7, but lua51.dll doesn't come with the sourceforge binaries. So Desmume gleefully used my own version (LuaJIT). I wonder why that doesn't work though... maybe some internal use of string.dump or sth. like that... I'm pretty confident it's gonna work with vanilla Lua.

--edit: It works with vanilla Lua, but NOT with LuaJIT 2.0 (which is a pity). Any opinions about making Desmume LuaJIT compatible? Advantages would be:

  • Faster

  • Excellent integrated FFI-module (easier to call C functions from within LuaJIT than from a C program)

  • Bit-manipulation library integrated, and IIRC exchangeable with the current one

Last edited by h4rdc0ded (2011-04-19 20:18:22)


#2 2011-04-19 19:59:29

Radical Ninja
Registered: 2009-01-05
Posts: 4,835

Re: [solved] 0.9.7 and Lua

desmume may use lua in secret undocumentated ways, and count on the internals of lua being unmodified. thats why we used to static link it, but then people had trouble using add-on dlls compiled against luabinaries-built dlls. this despite my assurances that I would static link any add-ons that people needed. but nobody ever tells me anything.


Board footer

Powered by FluxBB