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

Search results

  1. stetre

    Where can I find the values of things like 'LUA_OK'

    The value of LUA_OK is defined in the header file lua.h (it is 0, by the way). As for build instructions, see here under "Building": https://www.lua.org/download.html
  2. stetre

    How to configure LUA_INCDIR ?

    If it complains that it doesn't find the headers, it's likely the same problem as before but this time for the openssl library. I don't remember how it's called on RH, perhaps libssl-devel, or something like this.
  3. stetre

    How to configure LUA_INCDIR ?

    The error message complains about not knowing the path to the Lua headers (lua.h & friends, I presume). If you have Lua installed, then lua.h should be somewhere on your system. Run this on the command line to find it: $ locate lua.h
  4. stetre

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

    In particular when talking about languages the term is often use to denote the very basic part of the language.. syntax, constructs, keywords, and not much else. I should have noticed that that wasn't the meaning here, though. My bad.
  5. stetre

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

    Ops, I think I misunderstood your question. I wasn't aware that there is a development framework called 'Core Lua' out there. I thought that by 'core Lua' you meant the Lua library and nothing else... (what a misnomer, by the way!)
  6. stetre

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

    Quite the opposite, actually! I suggest to use one, unless one is willing to go down a rabbit hole! 😄
  7. stetre

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

    All you can do using only core Lua is to write games like text adventures. This is because, as you already know, core Lua is kept minimal by design. In particular, one of its design objectives is portability, which rules out including in the core things that are essential in games but depend...
  8. stetre

    Benefits of use Lua?

    I'll drop here a link to a talk that may be of interest for this topic: Why (and why not) Lua - Roberto Ierusalimschy [youtube]
  9. stetre

    Basic question about tables in Lua

    You talked about references, which is ok, but maybe in Lua it's better to talk about names and values, and read nested names starting from the innermost (or rightmost). After the first two lines, you have that a.a, a.a.a, a.a.a.a, a.a.a.a.a and so on are all synonyms for a.a. That is, the field...
  10. stetre

    Basic question about tables in Lua

    One nice thing about languages like Lua is that they are easy to experiment with. Try this: a = {} a.a = a a.a.a.a = 3 print(a) print(a.a) -- <----- !!! print(a.a.a.a)
  11. stetre

    Benefits of use Lua?

    Sorry, I misunderstood that you were learning Java just for this purpose. You see, Lua (actually its predecessor, Sol) was originally designed to be used by engineers working on oil platforms. That is, it was intended to be used proficiently to customize applications by people that despite...
  12. stetre

    Benefits of use Lua?

    Gosh, if you have to learn Java before learning Typescript it will take you years! Maybe you misheard Java for Javascript? Despite the similar name they are very different languages, and while Javascript is more or less in the same league as Lua, Java is an entirely different beast. By the way...
  13. stetre

    Benefits of use Lua?

    Well, then in this case the choice is restricted to a couple of alternatives, so it's just a matter of figuring out a few things: what are the advantages of using Typescript over Lua in this particular application (surely not performance), how reliable/documented/supported (in the foreseable...
  14. stetre

    Benefits of use Lua?

    The question "should I use language X?" is a bit ill-defined. The choice of a programming language depends on many things: the nature of the task at hand, its requirements (target platforms, performance, robustness, cost, milestones, ...), the availability of tools and, last but not least, of...
  15. stetre

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

    You probably mean chapters 13 and 16 of the PIL book (and section 2.4 of the manual).
  16. stetre

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

    All right. Now, if my assumption is correct and you're heading to object oriented programming, the next step would be to introduce metatables. That is, you can put the EditVal function in a table as 'mt' in the code below, and then set this table as the metatable of t, of s, and of any other...
  17. stetre

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

    As for the 'self', it's just the name of the function argument. Its scope is limited to the function. I called it 't', you called it 'self', but you can call it whatever you want (bar reserved keywords, of course). I personally don't like using 'self' that much because I feel that when there are...
  18. stetre

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

    No, you have to pass the table itself as argument to the function: t={ val=3 ,EditVal=function(t) --<------ t.val=4 end } print(t.val) --Should print 3 t.EditVal(t) print(t.val) --Should print 4 -- You can also use the 'colon syntax' to execute the function: t:EditVal()...
  19. stetre

    Previous value in table

    This should work. As a general note, Lua tables are very versatile data structures which are good enough for many purposes, but at times you'll find that other kinds of data structures are better suited to the problem at hand. This case is one of them: using a plain table you need to traverse...
  20. stetre

    Previous value in table

    It's... meh. This is basic computer science: the operations you want to perform on your data suggest the data structure to use. Here you are using a plain table as if it were a linked list (which in a sense it is), but if you need the 'prev' operation, a doubly-linked list is more apt.
Top