Search found 211 matches

by Xgoff
Wed Nov 29, 2017 5:59 am
Forum: General
Topic: LuaJIT ffi, reference to union member array
Replies: 4
Views: 1127

Re: LuaJIT ffi, reference to union member array

I'm not doing type punning in the example though, just plain writing, and (later) reading the same field. If you're talking about your first post... well there's no reading going on. Anyway, I assume this thread has something to do with your Blob library, and you certainly are doing quite a bit of ...
by Xgoff
Wed Nov 29, 2017 12:40 am
Forum: General
Topic: LuaJIT ffi, reference to union member array
Replies: 4
Views: 1127

Re: LuaJIT ffi, reference to union member array

What you're doing with this union (writing to one field and reading from another) is called type punning, and you have to be really careful when doing it; LuaJIT has strict rules around doing things like this (to allow better optimizations), and the behavior you're experiencing is a result of that. ...
by Xgoff
Fri Dec 25, 2015 7:11 am
Forum: General
Topic: Post-0.10.0 feature wishlist
Replies: 177
Views: 33934

Re: Post-0.10.0 feature wishlist

• Support for different Image and ImageData pixel formats, including floating-point formats (e.g. storing arbitrary number values in pixels). This can be useful for advanced rendering techniques and similar things, but said formats aren't always supported by all of the graphics hardware that LÖVE s...
by Xgoff
Sat Jul 04, 2015 3:49 pm
Forum: Support and Development
Topic: Attempt to yield across C-call boundary
Replies: 2
Views: 754

Re: Attempt to yield across C-call boundary

move the require outside of the coroutine, save its result into a local, then call that result from inside the coroutine instead
by Xgoff
Tue Jun 30, 2015 3:20 pm
Forum: General
Topic: [SOLVED]Anonymous Function Scope
Replies: 3
Views: 697

Re: [SOLVED]Anonymous Function Scope

yes, whenever possible you should return functions instead of dumping/loading them for informational purposes: in lua 5.2/5.3 or luajit, it is in fact possible to "fix" upvalue bindings of loaded functions via debug.upvalueid and debug.upvaluejoin , but obviously you should only be doing things like...
by Xgoff
Tue Jun 16, 2015 4:55 pm
Forum: Support and Development
Topic: Custom types in Lua
Replies: 17
Views: 3482

Re: Custom types in Lua

Let me start by saying that when doing OOP, "asking something what's his type" is considered a "bad smell in the code". There are some cases where it is reasonable to do so, but in general what you do is implementing methods in that class/type. This is how you would do a "type switch" with middlecl...
by Xgoff
Mon Mar 16, 2015 4:12 pm
Forum: Support and Development
Topic: SVG images?
Replies: 8
Views: 2196

Re: SVG images?

a few years ago i considered writing an svg-handling lib, but even svg tiny's spec is over 400 pages so i just went "nope"

this was also before Meshes were added to love so it probably would have not been the most pleasant thing to implement
by Xgoff
Tue Jan 06, 2015 3:56 pm
Forum: General
Topic: Maximum indexes in an array?
Replies: 7
Views: 2035

Re: Maximum indexes in an array?

as mentioned, the theoretical limit is very high the practical limit is going to be lower, of course. huge tables containing millions of elements are probably not the best for performance, because the GC has to traverse them (atomically!) in order to find any GCable objects it might be holding, but ...
by Xgoff
Wed Oct 15, 2014 1:00 pm
Forum: General
Topic: thread:pause() ?
Replies: 14
Views: 3811

Re: thread:pause() ?

How can I do this, so that the player can't delete this love.timer.sleep() ? The player could use a while-loop! unless this is a server program, i wouldn't worry too much about the user shooting their own foot Can I yield a coroutine automatically after time? Something like this: coroutine:resume(f...
by Xgoff
Thu Jul 24, 2014 6:31 am
Forum: General
Topic: love.audio.play(my_sound) vs my_sound:play()
Replies: 6
Views: 1900

Re: love.audio.play(my_sound) vs my_sound:play()

text:len() string.len(text) Yeah the same The length operator (#text) should probably be preferred for getting the length of a string - the official online edition of the Programming in Lua book was written for Lua 5.0 which didn't have the length operator, so it doesn't mention it unfortunately. I...