µLua DS - Forum officiel | Official forum Forum Index

µLua DS - Forum officiel | Official forum
Le bon endroit pour en savoir plus sur MicroLua et pour parler de vos projets ! | The right place to learn more about MicroLua and talk about your projects !

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Microlua and Luajit 2.0.1

 
Post new topic   Reply to topic    µLua DS - Forum officiel | Official forum Forum Index -> English section -> Dev's place
Previous topic :: Next topic  
Author Message
habababa


Offline

Joined: 07 Mar 2013
Posts: 21
Localisation: Philippines

PostPosted: Tue 26 Mar 2013 - 12:18    Post subject: Microlua and Luajit 2.0.1 Reply with quote

Here's the link to the sources of the Luajit compatible version of microlua.
Included are the binaries and lua/libs folder.
Using the jit-enabled(*+jit) binary isn't suggested but it's supposed to be better.
I haven't tracked down all C-code that interferes with JIT compiled code yet so 
just backup your sd-card if you ever use it.(JIT Code being incompatible with the old System.listDirectory function erased ALL of my card's contents.)




http://www.mediafire.com/?e92ae93pz3vz5o7


I also bumped the ULUA_VERSION TO 4.6.1_b.




not yet implemented:
3d - znear and zfar values are too "near" in ulib. Models are also drawn with black textures even when there is specified(lacks specific GL_ params)
see ds_model.c
frameskip - currently, ulib doesn't allow frameskip(requires screen.waitForVBL to be called every frame)


From CHANGES.TXT:
Quote:
All light userdata converted to full userdata to let lua handle all collection.
*.destroy functions are now obscured from lua since explicitly calling __gc metamethods crashes lua.




SYSTEM
  replaced bulky and inefficient System.listDirectory code.
  System.getvertexcount()
    returns Vertex Count.Useful in knowing why objects suddenly disappear from the screen.
  System.getpolygoncount()
    returns Polygon Count.Useful in knowing why objects suddenly disappear from the screen.
  System.runndsfile(filename,{ARGV[0],ARGV[1],...})
    runs nds homebrew filename.Make sure to System.changeDirectory to the directory of the nds file before calling this function.In compliance with libnds argv protocol, pass the name of the nds file to be executed as ARGV[0]This is required for efslib and nitrodir to work.However some homebrew might require ARGV[0] to be of some other value.Moonshell2 extlink compatible homebrew use ARGV[0] as the file to be loaded upon startup.
    Soft-reset(L+R+START+SELECT) for the executed file will boot "fat:/BOOT.NDS".




CONTROLS
  Added test code for Controls.
  Stylus changed to full userdata
    valid indices:newPress, held, released, delay, autorepeat, doubleClick, clickdelay, X, Y, deltaX, deltaY
    (set delay and repeat values through Keys.delay.Touch and Keys.autorepeat.Touch)
  Keys.newPress changed to full userdata
  Keys.held changed to full userdata
  Keys.released changed to full userdata
  added Keys.newRelease.*
    valid indices:A,B,X,Y,L,R,Up,Down,Left,Right,Start,Select,Lid,Touch
  added Keys.delay.* 
    valid indices:A,B,X,Y,L,R,Up,Down,Left,Right,Start,Select,Lid,Touch
    __index returns status
    __newindex sets delay value(0 cycles - 32767 cycles)
  added Keys.autorepeat.*
    valid indices:A,B,X,Y,L,R,Up,Down,Left,Right,Start,Select,Lid,Touch
    __index returns status
    __newindex sets repeat value(0 cycles - 32767 cycles)
  
SCREEN
  added screen.drawTextFontBox(screen,x1,y1,x2,y2,text,color,font)
  added screen.drawTriangle(screen,x1,y1,x2,y2,x3,y3,color)
  added screen.drawFillTriangle(screen,x1,y1,x2,y2,x3,y3,color)
  added screen.shotBMP(filename[x[,y[,width[,height]]]])




TIMER
  Timer lib moved to C




FONT
  Font.destroy() removed
  Font metamethods:
    font:getStringWidth()
    font:getCharHeight()




Image
  Image.destroy() removed
  Image metamethods:
    image:width()
    image:height()
    image:scale()
    image:rotate()
    image:rotateDegree()
    image:mirrorH()
    image:mirrorV()
    image:setTint()
    __index & __newindex:
      image.x         - image X position
      image.y         - image Y position
      image.stretchX  - image scaled horizontal size
      image.stretchY  - image scaled vertical size
      image.angle     - image angle(0 is 0 degrees, 32767 is 360 degrees)
      image.centerX   - center X for image rotation
      image.centerY   - center Y for image rotation
      image.offsetX0  - x offset from image source
      image.offsetX1  - x offset from image source
      image.offsetY0  - y offset from image source
      image.offsetY1  - y offset from image source
      image.tint1     - color of Top-Left corner of image
      image.tint2     - color of Bottom-Left corner of image
      image.tint3     - color of Bottom-Right corner of image
      image.tint4     - color of Top-Right corner of image
      image.sizeX     - image real size X
      image.sizeY     - image real size Y




CANVAS
  MAX_OBJECTS decreased to 1024 for less memory consumption
  added Canvas.newTextFontBox(x1,y1,x2,y2,text,color,font)
  Canvas.destroy() removed
  
  Canvas.new(arg)
    if arg is a number, returns canvas with arg slots.
    if arg is a table, creates canvas and adds objects from table to canvas.
    Suggested usage:canvas = Canvas.new(dofile("createcanvas.lua"))
      createcanvas.lua:
      return {{Canvas.newPoint, 0,0},{Canvas.newFillRect,0,0,256,192}}




  Canvas.add(canvas, object[, slot])
    inserts object at position pointed by slot, or places object at the end of the canvas if slot not specified.




  Canvas.__len() (# operator)
    returns total objects in canvas and returns maximum objects for the canvas
    len, max = #canvas




  CanvasObject __index & __newindex
    type    - set/get the object type
    x1      - set/get object x1(ATTR_X1)
    y1      - set/get object x1(ATTR_Y1)
    x2      - set/get object x1(ATTR_X2)
    y2      - set/get object x1(ATTR_Y2)
    x3      - set/get object x1(ATTR_X3)
    y3      - set/get object x1(ATTR_Y3)
    x4      - set/get object x1(ATTR_X4)
    y4      - set/get object x1(ATTR_Y4)
    srcx    - set/get object srcx(image source x position)
    srcy    - set/get object srcy(image source y position)
    imgw    - set/get object imgw(image width)
    imgh    - set/get object imgh(image height)
    color   - set/get object color(ATTR_COLOR)
    color1   - set/get object color(for gradients)
    color2   - set/get object color(for gradients)
    color3   - set/get object color(for gradients)
    color4   - set/get object color(for gradients)
    text     - set/get object text(ATTR_TEXT)
    visible  - set/get object visible(ATTR_VISIBLE)
    font     - set/get object font(ATTR_FONT)
    img      - set/get object image(ATTR_IMAGE)
    notes:
      setting the font/image attribute multiple times is fine but
      avoid getting the font/image attribute multiple times as this creates a
      copy of the font/image pointer for each call.
      example:
        while 1 do
          ...
          local image = canvasobject.img
          ...
        end




MAP
  Map.destroy() removed




ScrollMap
  ScrollMap.destroy() removed

  


  

  


Back to top
Publicité






PostPosted: Tue 26 Mar 2013 - 12:18    Post subject: Publicité

PublicitéSupprimer les publicités ?
Back to top
geeker


Offline

Joined: 23 Dec 2012
Posts: 363

PostPosted: Fri 29 Mar 2013 - 17:22    Post subject: Microlua and Luajit 2.0.1 Reply with quote

Quote:
MAP
 Map.destroy() removed


And how can I destroy the map ? with a "mymap = nil" ?
_________________
Beta-testeur de l'extrème
Tox: FFBDC8B34DC3CDE51F8F1CB0A628147DE740ACD1D44682EB5492A681F6541E32E8D8BB6052B3
CtrµLua: ctrulua.github.io
Des p'tits true, des p'tits true, toujours des p'tits true ...


Back to top
Visit poster’s website
Reylak
Administrateur

Offline

Joined: 24 Nov 2008
Posts: 2,838
Localisation: Toulouse

PostPosted: Fri 29 Mar 2013 - 20:10    Post subject: Microlua and Luajit 2.0.1 Reply with quote

habababa wrote:
All light userdata converted to full userdata to let lua handle all collection.
*.destroy functions are now obscured from lua since explicitly calling __gc metamethods crashes lua.


It means that (Micro)Lua will handle this automatically. But is this really working ? Surprised
_________________


Plein d'infos sur le SourceForge !


Back to top
Visit poster’s website MSN Skype
habababa


Offline

Joined: 07 Mar 2013
Posts: 21
Localisation: Philippines

PostPosted: Sat 30 Mar 2013 - 10:26    Post subject: Microlua and Luajit 2.0.1 Reply with quote

geeker wrote:
Quote:
MAP
 Map.destroy() removed








And how can I destroy the map ? with a "mymap = nil" 






Yep, "mymap = nil".Call "collectgarbage('collect')" twice if your need for free memory is urgent.

@Reylak
Works for me.Lua's automatic memory management is quite good.Only thing left to worry about is VRAM fragmentation.

edit:
There's a bug with canvas.__index
I can't upload right now but if you can recompile the sources then, 
add the line "co->assigned++;" to the file ds_canvasmeta.c


Quote:
inline void pushcopyofcanvasobj(lua_State *L, CanvasObject* co)
{
  void **wrapped_co = lua_newuserdata(L, sizeof(CanvasObject*));
  *wrapped_co = co;
co->assigned++;
  udata_setmetatable(CANVASOBJ_REGKEY);
}






wthout this, code that goes like:


Quote:
local object = canvas[1]
object = nil
collectgarbage()
collectgarbage()



will crash lua. Laughing


and for maps:
replace all occurences of u16 to s16 in file "ds_map.c" to allow negative tile indices.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    µLua DS - Forum officiel | Official forum Forum Index -> English section -> Dev's place All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  

Index | Create a forum | Free support forum | Free forums directory | Report a violation | Cookies | Charte | Conditions générales d'utilisation
Powered by phpBB © 2001, 2005 phpBB Group