Search found 1788 matches

by raidho36
Tue Jul 16, 2019 11:50 am
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 21
Views: 432

Re: What is setUserData and why do I need it?

I don't understand this. I don't follow this logic. LOVE immediately unrefs the objects that it no longer keeps internal track of (unless they were never tracked in the first place). Having strong reference internally means that the object will always have at least one strong reference and cannot b...
by raidho36
Mon Jul 15, 2019 9:41 pm
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 21
Views: 432

Re: What is setUserData and why do I need it?

It does counts internal references as strong ones, however it doesn't actually keep them. Box2D's internal references are not counted as strong ones because then it would be impossible for physics objects to get garbage collected. Not sure about calling __gc twice though. Only the source code invest...
by raidho36
Sun Jul 14, 2019 9:38 pm
Forum: Support and Development
Topic: Object inheritance
Replies: 26
Views: 615

Re: Object inheritance

In my class implementation, inheritance workflow is set up like this: local baseclass = Class ( "baseClassName" ) function baseclass:foo ( ) ... local derivedclass = baseclass:extend ( "derivedClassName" ) function derivedclass:bar ( ) ... Internally, it copies over all data from base class into der...
by raidho36
Sun Jul 14, 2019 9:24 pm
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 21
Views: 432

Re: What is setUserData and why do I need it?

Now that I think about it, I no longer think it's thread safe. The context that the function expects won't exist in a different thread, so it can't execute safely. The other thread will simply have its own separate userdata storage, on account of residing in a totally separate Lua state. It's perfe...
by raidho36
Sat Jul 13, 2019 9:33 pm
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 21
Views: 432

Re: What is setUserData and why do I need it?

Also, I tried the weak table technique and it didn't work as expected. Weak keys are collected almost right away regardless of whether the bodies are destroyed or not. Make sure your weak keys and weak values have strong references elsewhere. If their only references are weak ones, they're counted ...
by raidho36
Fri Jul 12, 2019 2:38 pm
Forum: Libraries and Tools
Topic: Some useful Lua libraries
Replies: 0
Views: 98

Some useful Lua libraries

https://bitbucket.org/rcoaxil/lua-minilibs

* class
* object pool
* gapless array + unique value variant
* linked list
* deque
* few minor ones

I've created these over the course of development of my own projects and I thought I'd share.
by raidho36
Thu Jul 11, 2019 6:52 pm
Forum: Support and Development
Topic: What is setUserData and why do I need it?
Replies: 21
Views: 432

Re: What is setUserData and why do I need it?

TL;DR: just ignore it. This is physics-specific; yes you will have to get-set the data. This feature is generally pointless, considering that you can simply use a table lookup instead and it'll work faster on account of not having to do the C++ to Lua transition and back. userdata[physicsobject] = w...
by raidho36
Wed Jul 10, 2019 1:30 pm
Forum: General
Topic: How do you make a game?
Replies: 3
Views: 921

Re: How do you make a game?

I usually just like make game.
by raidho36
Wed Jul 10, 2019 1:29 pm
Forum: Support and Development
Topic: Creating a physics engine
Replies: 4
Views: 149

Re: Creating a physics engine

You probably won't be able to do any better than Box2D is already doing, in terms of performance anyway. So if you feel like doing a trigonometry exercise then go ahead, but otherwise you should just learn to use an existing physics engine instead.
by raidho36
Tue Jul 09, 2019 3:12 pm
Forum: Support and Development
Topic: Best way to transfer physical objects between worlds?
Replies: 1
Views: 62

Re: Best way to transfer physical objects between worlds?

I would suggest simply using the same physics world. But otherwise yes, you must copy over the data.