lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


One issue I noted in further testing is when you try and set a new metatable to a latebound table you wipe out the mechanism for binding functions
I used the __metatable method to block this but I really don't want to make that permenant
so I added removal of the metatable when you bind all functions

I also added the __call metamethod to make it a bit more intuitive to bind a function

for instance.. the math table
f_add = math("add") -- binds add function

local t = {dummy = "dummy"}
setmetatable(math, t) -- ERROR 'cannot change a protected metatable'

math(nil) -- binds all math functions
local oldt = getmetatable(math) -- oldt == nil
setmetatable(math, t) -- success

here is the patch I submitted to our repository http://gerrit.rockbox.org/r/#/c/1922/

On Fri, Sep 14, 2018 at 9:05 AM, me the user <bilgus.suglib@gmail.com> wrote:
It'd be nice if it weren't so dependent on floats being scattered all through the code our implementation is pretty custom anyways
I spent an hour trying to get around all the floats and exponents but the underlying parts worked well

On Thu, Sep 13, 2018 at 3:38 AM, Bogdan Marinescu <bogdan.marinescu@gmail.com> wrote:

On Thu, Sep 13, 2018 at 8:44 AM Walter anderson <bilgus.suglib@gmail.com> wrote:
I found out it works perfectly well as a lua_register replacement but a bit more testing needs done before I'd declare it a success

I find it really useful to run the Lua test suite (https://www.lua.org/tests/) after every change that I do to the Lua source code. It caught loads of errors in my changes, especially in the LTR patch. It might help you too.

Best,
Bogdan