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

Search results

  1. 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...
  2. 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.
  3. 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...
  4. 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"?
  5. 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?
  6. H

    If I wanna create a game using Lua, where should I start?

    Since I learned various things of Lua and I think I can start for creating my own things, I ask you, where can be an good starting point?, because I don't know if Lua have its own editor or compiler, all of I did is in Warcraft III and VSCode.
  7. H

    Benefits of use Lua?

    After a while using Lua, I asked myself, why should I? because is not type-safe because there are not types and is too permissive when it compiles because the way it interpret the code, making harder find errors. The benefits I can think are is too flexible making it easier to code, but I'm not...
  8. H

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

    I searched and I didn't find anything, what I ask if I can do something like this, just to put an example: t={ val=3 ,EditVal=function() t.val=4 end } print(t.val) --Should print 3 t.EditVal() print(t.val) --Should print 4
  9. H

    Previous value in table

    As well as exists the function "next" to get the next value in a table, is there an equivalent to the previous value if I set the index?
  10. H

    How works metamethods?

    I know I can investigate it, but I think is better is someone explains me.
  11. H

    Is there a way to detect when a variable is edited?

    I ask this because I wanna know if I have a variable lets call it x, and somebody do x=<value>, but the value is invalid for some reason I wanna establish so then automatically x is set to nil.
  12. H

    Optional Library

    I'm not sure if you have an idea of what library means, but in my case when I say library is a code with functions and data that I can use to help me in my programming and that I can share with others, just I wanna know if there is a way to detect if there is that library in my code to erase or...
  13. H

    Question about comments

    In others program languages you can do something like this: /*Hello How are you?*/ In Lua I think is --[[Hello How are you?]] Is there a way to do "comment" section but that looks like normal code to make it easier to look?
  14. H

    Text macro

    Hello, I'm new here and I starting to learn about Lua, something I wanna ask is a thing that is used in another programing language called text macro, that replicates a code with small difference any time, basically it works like this: textmacro EXAMPLE("func1","X") textmacro...
Top