• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Search results

  1. H

    Is there a way to reffer a table itself inside the same table?

    @stetre but there will be a noticeable change if I do that a lot or still insignificant?
  2. H

    Is there a way to reffer a table itself inside the same table?

    Question, the functions rawset and rawget are faster than use the normal "table[key] = value"?, because they act without using the metamethods __index and __newindex respectively.
  3. H

    Is there a way to reffer a table itself inside the same table?

    @stetre Ah ok, I got it. Thanks
  4. H

    Weight Table issue...

    @Kaiome do you wanna me being even more specific? well, Look the line numbers of the code I posted before In the line 4: for z,p in pairs do The functions pairs need an input, likepairs(some_table) and I think you already now that. In the line 5: table.insert(weightranges,{Item = z.Min =...
  5. H

    Is there a way to reffer a table itself inside the same table?

    I tested and I noticed that if they can be a chain of metatables Lua doesn't search fields in the metatable of a metatable local t = {} setmetatable(t, {__index = {}}) setmetatable(getmetatable(t), {__index = {hola = 3}}) print(t) print(getmetatable(t)) print(getmetatable(getmetatable(t)))...
  6. H

    Weight Table issue...

    Please use the code option in the more options menu, your code should look like this: function decide(weighttable) local weighttotal = 0 local weightranges = {} for z,p in pairs do table.insert(weightranges,{Item = z.Min = weighttotal,+1Max = weighttotal + p}) end...
  7. H

    Optional Library

    @stetre Thank you, it worked.
  8. H

    Optional Library

    I tried use the requiere function (recent now because I didn't have a compiler) and it didn't worked, what I'm doing bad? because I have this 2 scripts: This is called "mymath.lua" local mymath = {} function mymath.add(a,b) print(a+b) end function mymath.sub(a,b) print(a-b) end...
  9. H

    Lua compiler

    Thank you, it worked.
  10. H

    Lua compiler

    @Sonazuma Thanks, but I don't use Unix, I use Windows, and this is not clear to me
  11. H

    Lua compiler

    I wanna test if some methods I created using Lua, but I don't where can I get its own compiler if is not a game that uses Lua, and I don't wanna open it everytime I need test something simple, is there a "basic compiler"?
  12. H

    Is there a way to reffer a table itself inside the same table?

    @stetre I understand you, I'm programming in Java too and this things with the classes sometimes can be a headache (And is really useful use anything as an index), I don't wanna try to emulate 100% the OOP in Lua, but I just wanna do this to have it more organized.
  13. H

    Is there a way to reffer a table itself inside the same table?

    Thank you, but what do you mean with this?
  14. H

    Is there a way to reffer a table itself inside the same table?

    Question, for what I do, how can I do inheritance? I read but I don't end of understand it.
  15. H

    Can an anonymus function call itself?

    If it will be to convoluted and I don't end to understand how it works, and it seems you are doing this thinking I will use that method everytime I need use that function losing the point of naming a function, I just wanna know if I can do something, like this: -- func is a function that needs a...
  16. H

    Can an anonymus function call itself?

    @GavinW At the end what you said I don't think is what I asked, because you are still naming functions, and what you suggested don't even do what you said, it printed: function: 00000<Always a different "code"> But that thing of Combinatory algebra looks interesting but complicated. No, I want...
  17. H

    Can an anonymus function call itself?

    @GavinW I don't understand, can you explain me please?
  18. H

    Can an anonymus function call itself?

    I wanna add recursion to anonymus functions, is there a way to do that? like a keyword or a process or yes or yes must have a name?
  19. H

    How does an operation that relates to a value relate to a table that is in order.

    If you wanna do something like this: t = { val = 3, func = function() print(t.val) --This won't print 3 end } Better look this tread Is there a way to reffer a table itself inside the same table?
Top