Results 1 to 4 of 4
  1. #1
    Moderator _Zack_'s Avatar
    Join Date
    Nov 2005
    Posts
    801

    possible to code an emulator in Lua?

    Im just wondering if it would be possible to code an emulator in Lua?

    Or would it be possible to convert c to lua and port an emulator that way?

    And finally, would lua be powerfull enough to handle an emulator? even a basic one like a chip8 emu?

    Proud Moderator Of Emutalk.net

    My iPhone / iPod Touch Games :



    • Advertising

      advertising
      EmuTalk.net
      has no influence
      on the ads that
      are displayed
        
       

  2. #2
    EmuTalk Member
    Join Date
    Mar 2006
    Posts
    13
    Yes, you can code an emulator in any half decent programming language. The question is whether the language is well suited to the problem or not. Lua would definitely handle a chip8 emu, but if you were trying a complete game system it might not be fast enough.

  3. #3
    Emu Author
    Join Date
    Apr 2003
    Posts
    248
    lua could probably handle Gameboy without much trouble, it's actually pretty fast. You'd have to change the number representation to integers though, if I remember correctly there's a #define for that (by default, lua does ALL math with double precision floating point numbers, which is not what you want for emulation for many reasons). Also, you'd have to write some well designed wrapper functions in C to allow lua to write to some kind of display, get input etc.

  4. #4
    Moderator Cyberman's Avatar
    Join Date
    Nov 2001
    Posts
    1,824

    Yet another reply (YAR)

    To answer your question yes it is possible.

    I've seen LUA used for a ISO image manipulation system so pretty much anything is possible.

    You will need to give LUA IO capability to the keyboard and game input devices. In addition to that LUA will need access to the sound and video systems in the API. If you are using window this would be Win API access.
    You might be able to use the GDI etc. Essentially you will need to put in direct hooks into the OS in LUA to support such functionality.

    For something like a Unix type system things get a bit more interesting. File IO can be used to access many things, audio via "/dev/dsp". PIPEs can be used to access the display. I'm not sure how to advise you in the best route for accessing X resources.


    Cyb
    Progress (n.):
    The process through which the Internet has evolved from smart people in front of dumb terminals to dumb people in front of smart terminals.
    -------------------------------------------------------------------
    Recursive (adj):
    see Recursive

Similar Threads

  1. Donkey Kong 64 - Moon Jump Code Sorted
    By Rastaman360 in forum PJ64 Cheats
    Replies: 3
    Last Post: September 7th, 2006, 14:31
  2. Guess What
    By kylethedarkn2 in forum Dolphin
    Replies: 7
    Last Post: April 7th, 2006, 12:00
  3. Hacking on the code.
    By AlonzoTG in forum TR64
    Replies: 7
    Last Post: February 23rd, 2005, 22:02
  4. Replies: 95
    Last Post: January 20th, 2004, 11:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •