2010
05.03

lua true color sample!

Everything is not there yet (no sample or renderer menu), but 78 fps is not bad. I get 28 fps with the python sample on the same VM (and 220 with C++). The source is on svn, but compiling the wrapper is a bit funky right now. I’ll try to provide a compiled wrapper with the 1.5.1b1… Also, the swig generated wrapper is not optimal. You have some redundant stuff as in rng.getInt(rng,0,2) or libtcod.TCODConsole_isWindowClosed(). Would require some tweaks to get rng.getInt(0,2) and libtcod.Console_isWindowClosed(). Yet, it’s a start.

5 comments so far

Add Your Comment
  1. Awesome. I’m glad the lua wrappers work!

  2. Lua has syntactic sugar for that — rng:getInt(0, 2), which is identical to rng.getInt(rng, 0, 2), and is one of the usual ways to do method invocation. Removal of the other kind of redundancy is a very easy matter from within Lua. Here’s a modest example that will let you call tcod.console.isWindowClosed; the format will be mangled, no doubt:

    local tcod = { }
    for key, value in pairs(libtcod) do
    if type(key) == “string” then
    local library, name = key:match(“^TCOD([^_]*)_(.*)”)
    library = library:lower( )
    tcod[library] = tcod[library] or { }
    tcod[library][name] = value
    end
    end

  3. Mmh, very interesting indeed, thx. I’ll try to apply that tothe sample

  4. I had no idea Lua was that much faster than python :O

  5. To be fair, we should compare the lua wrapper with a swig generated python wrapper.