Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

LUA or PyGame

Name: Anonymous 2011-11-24 13:26

I was wondering, me and my buds wanna start making a game and we wondering which language (LUA or Pygame) we should use for that. Any recommendations or information about these 2?

Name: Anonymous 2011-11-24 13:28

PyGame would be easier for starting out.

Name: Anonymous 2011-11-24 13:34

SEPPLES

Name: Anonymous 2011-11-24 13:38

What about LUA?? i've heard good things about it

Name: Anonymous 2011-11-24 13:42

LUA isn't really useful, while Python, however slow it may be, is a good all-purpose scripting language. You'll find more use for it.

Name: Anonymous 2011-11-24 13:48

why LUA isn't useful? I've seen a lot of games using it

Name: Anonymous 2011-11-24 13:49

Lua is great. Python is a nightmare.

Name: Anonymous 2011-11-24 13:52

Python is great. Lua is a nightmare.

Name: Anonymous 2011-11-24 13:52

Lua is a nightmare. Python is great.

Name: Anonymous 2011-11-24 13:53

Python is a nightmare. Lua is great.

Name: Anonymous 2011-11-24 13:59

Speak something useful

Name: Anonymous 2011-11-24 14:02

>>6
You can use Python the same way, as well as Scheme, Perl, even Ruby, ..., more or less any scripting language can be used to extend games.
And Python with PyGame or Pyglet is probably better to write games in. Also, it's better overall as a language and is a better tool for more areas.

>>7,10
Array indices starting at 1.

Name: Anonymous 2011-11-24 14:11

More advices? More info? We need some more info about the differences between these 2 languages

Name: Anonymous 2011-11-24 14:11

>>12

array indices starting at zero is usually really confusing for a beginning programmer, so making them start at one makes one less thing for a newbie to get tripped up on. Indices that start at zero are more important to have in a language that allows arbitrary pointer arithmetic. It makes more sense in that situation for a pointer to an array to point to the first element in the array. But this type of access isn't really allowed in python,java,ect, and there wouldn't be that much of a difference if the indices started at 1 instead of 0.

Name: Anonymous 2011-11-24 14:13

Name: Anonymous 2011-11-24 14:20

>>14
The only benefit indices starting at one have is to keep beginners from having to differentiate between ``first element'' and ``element one''. Most programmers learn to work with indices starting at zero in a matter of days, at most.
Also, starting with zero, it makes it easier to program. Just consider a for loop, wouldn't using something like for (i=1; i<=length; i++) to iterate over all of it look a bit strange? Or using i<=length to check if i is not out of bounds?
There's also the compatibility with more or less all the other languages. Is a tiny benefit for the absolute beginners worth it?

Name: Anonymous 2011-11-24 14:23

>>15
that link is from 3 years ago

Name: Anonymous 2011-11-24 14:31

>>17
Use your scroll wheel, please.

Name: Anonymous 2011-11-24 14:32

>>16

It is just a different way of doing things. Lua was originally meant to be used as a flexible form of data entry by people who didn't necessarily know how to program, so they tried to reduce the learning curve as much as possible. The beginning lua programmer will be in for a surprise when he/she moves on to a popular language that uses 0<=i<length indexing. But you could say the same about any unique characteristic of any language. A cprogrammer will be suprised by the use of tail recursion for looping in scheme. A java programmer will be surprised by the absence of public static void createFactoringFactoryFactory(FactoringFactory factory). There are many ways to do the same thing, and part of being a knowledgable programmer is understanding that there are many different conventions and ways for doing the same sorts of things, each with their own advantages and disadvantages.

Name: Anonymous 2011-11-24 14:36

>>19
That's true enough, but it's still mostly unnecessary, since getting used to such a minor detail is far easier than switching between 0-start and 1-start indices all the time (you'll just get your algorithms mixed up if you aren't careful enough).

Also,
public static void createFactoringFactoryFactory(FactoringFactory factory)
Why void, if it's a factory?

Name: Anonymous 2011-11-24 14:44

Lisp is shit.

Name: Anonymous 2011-11-24 14:49

>>20

wups thanks you:


public static FactoringFactoryFactoryable createFactoringFactoryFactory(FactoringFactory factory)


That's true, porting back and forth between zero indecies and 1 indices is annoying and error prone, and could be completely avoided with a different design decision for the language. You could always introduce your own indexing functions:


function zset(table, index, value)
  table[index + 1] = value
end

function zget(table, index)
  return table[index + 1]
end

function zipairs(table)
  return coroutine.wrap(function()
    for i,v in ipairs(table) do
      coroutine.yield(i-1, v)
    end
  end)
end


Although that zipairs could be more efficient. I always use closures for my iterators so I can pass them around as arguments to functions.

Name: Anonymous 2011-11-24 14:53

>>22
I'm not that good with Lua, but I think I heard that the start index is the one you manually set, 1 is just the default. Or am I confusing Lua indices with something else?

Name: Anonymous 2011-11-24 15:02

the best part of python is guido

Name: Anonymous 2011-11-24 15:09

>>23

lua is really flexible in that a table functions both as an array, and as a hash table. So internally, there is an array section that is indexed by integers, and a hash table part that is indexed by arbitrary keys. I'm not sure what the defined behavior is if you where to start assigning values into into high indecies. But on my lua:


Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
a = {}
a[6] = 9
for i,v in ipairs(a) do print(i,v) end
for i,v in pairs(a) do print(i,v) end
6       9
a[1] = 34
for i,v in ipairs(a) do print(i,v) end
1       34
for i,v in pairs(a) do print(i,v) end
1       34
6       9


making assignments to the next index in the array inserts it into the array section (which gets iterated by ipairs), and the other assignments go into the hash table section. You actually could just use zero indexing, and the zero would be treated as a hash table key, and would be indexed there. The only glitch is that the zero key would not show up if you used ipairs to iterate. You could use pairs, which iterates over both the array and the hash table, but then the zero key isn't necessarily processed first. You could make your own iterator, which first returns 0, a[0], and then continues with ipairs.

Name: Anonymous 2011-11-24 15:13

>>25
Ah, I see. Interesting.
Does Lua also have a list/array in the built in types, like Python? What if I only want that and not a hash table?

Name: Anonymous 2011-11-24 15:20

>>3 is right, you others can go to hell.

Name: Anonymous 2011-11-24 15:26

>>26
If you want things to be ``like python'' use python you enormous faggot.

Name: Anonymous 2011-11-24 15:30

>>28
There's a difference between wanting Lua to be Python and wanting to use a list instead of a hashtable.

Name: Anonymous 2011-11-24 15:30

>>26

no there are no lists unfortunately. People typically implement lists using tables like structs,


a = {}
a = {item='data1', next=a}
a = {item='data2', next=a}


If you wanted more efficiency, you could use try using c extensions to create a simple list for lua, but I'm not sure how you could get your C list to register its references with lua's garbage collector. It might be possible, but I haven't looked into it yet.

Name: Anonymous 2011-11-24 18:24

>>30

nevermind, according to these people, you can't

http://stackoverflow.com/questions/3034247/lua-userdata-gc

It doesn't look like you can refer to lua objects from your c code. This seems unnecessarily limited to me though. It's not like it would be difficult to register some userdata with a custom marking function written in c, that could get called by the garbage collector to mark the userdata object's references. also my list was wrong. First line should have been a = nil

Name: Anonymous 2011-11-24 20:46

>>31
The point of lua is to be a simple, lightweight scripting language. If you want something more robust, there are options. Every scheme distribution I can think of is made to do this sort of thing. Of course, using them becomes that much more complicated, which defeats the whole point of selecting a lightweight, simple scripting language in the first place.

Enjoy.

Name: Anonymous 2011-11-24 21:06

Lua is really fun to use.

Name: Anonymous 2011-11-24 21:27

>>33
oh you never had to write for awesome window manager

(actualy it's it's awful standart library, BUT NEVERTHELESS)

Name: Anonymous 2011-11-24 21:44

>>32
Lisp is shit.

Name: Anonymous 2011-11-24 22:58

>>31
To keep a reference to a lua object use
http://www.lua.org/manual/5.1/manual.html#luaL_ref
to get an unique key for it, and insert it into a table.

When it's time to release the reference, use luaL_ref again
but this time remove from the table.

Requiring you to do it in this kind of indirect way instead of having an equivalent to Python's Py_INCREF() and ability to call custom destructors for values of types other than table and userdata is a major Lua weakness, specially when version 5.2rc1 goes live with the new continuation based API for yielding out of CFunctions.

Name: Anonymous 2011-11-24 23:06

If it ain't Lisp, it's crap.

Name: Anonymous 2011-11-24 23:42

Luajit. http://luajit.org/

Python is fucking shit.

Name: Anonymous 2011-11-24 23:53

>>36
Reference counting is a major python weakness.

Name: Anonymous 2011-11-25 0:01

>>39
What abount absence of uniform syntax, leading to inability to extend it though macros?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List