Lua: Bug fix to refassoc feature.

I had 2 bugs.
First, I should have used the "uservalue" instead of the metatable.
I added #defines to map to lua_setfenv/lua_getfenv for backwards compatibility.

Second, unfortunately, my original idea to just put objectB in the array doesn't work
     in the final garbage collection sweep. While it keeps the object alive as we want for the normal execution,
     on collection Lua seems to be aware that objectA holds objectB
     and will collect them in the same pass instead of getting the finalize callback for objectA
     first, and then releasing objectB and getting the finalize callback for that.

     The order is the reverse order of when the __gc metamethods were defined,
     which is not helpful to us since we don't control the creation order of the objects.

     So to workaround this, we can create a layer of indirection by referencing objectB
     in the Lua Registry with luaL_ref. This way the object stays rooted until we call luaL_unref.
     We can call luaL_unref in the finalizer.

     The one annoying problem I can't solve for the user is lua_close.
     With lua_close, Lua frees everything in one pass, including the registry which means
     we lose control of the tear down order.
     If you only care about keeping references to other objects and not tear down order,
     you don't have to worry about this.
     If you do care about tear down order, before lua_close, all rooted objects should be nil'd
     and a full garbage collection sweep should be invoked.
     Users can set their objects to nil and call collectgarbage,
     or you can get clever and iterate through all keys in _G
     and set the references to nil, and then collect garbage on their behalf,
     but this won't get local variables/upvalues.
JavaScript: Fix unused parameter warnings. Also remove % from Printf to avoid unwanted format string.