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

Recent content by Herly Quijano

  1. H

    Variable can't decide what it is

    The thing in the second, the function type returns a string and you are comparing with a non-string values: -- Bad print(type(event.params.var1) == string) print(type(event.params.var1) == table) -- Good print(type(event.params.var1) == "string") print(type(event.params.var1) == "table") So you...
  2. H

    I wanna handle errors, but a program I'm using makes it difficult for me

    Hello, I'm using Warcraft 3 and I wanna handle better the errors, because it don't have its own event log I wanna create it myself to improve its debugging, but I have problems: It doesn't print the errors or warns unless you use "xpcall(func, print)", I can do that but it will make the errors...
  3. H

    Random

    I don't know what do you mean, because this: for i = 1, 10 do print(math.random(-10, 10)) end printed me this: -6 5 5 -7 6 -10 -10 -10 4 4
  4. H

    Lua error. My file name is trans.lua. the error is - trans.lua:1: '=' expected

    Hey, why did you add the ';'?, lua don't use it. Edit: Nah, you can use it, I think is your code convention.
  5. H

    Tables

    Do you know that the table is the variable "console" and not its childs?, but you can't do: console[1] = something Because console[1] is not a table, in fact, is not anything, the correct would be: console = {} console[1] = {} console[1].data = "a string" -- Or console = {{}} -- a table stored...
  6. H

    using global Variable in IF-THEN

    What if @Bobbie wanna use the 'require' function?
  7. H

    How to debug in Intellij

    Is not that a java compiler?
  8. H

    Lua self.<fieldName> not working as expected

    Because you defined the function 'addPlayer(player)' with the colon, but you called with just the dot newQueue.addPlayer(player) -- No newQueue:addPlayer(player) -- Yes If you don't know, what the colon does is adding an invisible parameter that is the table itself, basically: function...
  9. H

    How works _G and _ENV and what can I do with them?

    Thank you for the explanation.
  10. H

    How works _G and _ENV and what can I do with them?

    @GavinW I don't know, because I'm not much about reading long texts even if I'm interested in the topic, I do that but is too difficult to me, so I'm not sure in invest 27$ in a book (100 PEN in my country).
  11. H

    How works _G and _ENV and what can I do with them?

    I'm curious to know how they work and the information I found isn't enough so I need a better explanation and also wanna know what can I do with them because I see the programs that use Lua use them to create their global values.
  12. H

    Lua ignoring float type

    The library math have a function called math.type(number) that returns "float" or "integer" depending on the number or nil if is not a number, you can use it to see what is happening.
  13. H

    Ellipses assignment outside of a function?

    Don't you mean the first? because you add an extra comma.
  14. H

    Instance scripts?

    @stetre Interesting, I'm new on this of advanced programming so there is a lot of things I don't know.
  15. H

    Instance scripts?

    I was working in CoreGames for a couple of months, and I'm curious about how it works, basically the scripts can be objects, also can be instanceable, all the same script with its variables and functions, just in different contexts, is like they work as "functions" instead of being the main...
Top