Search found 1727 matches

by ivan
Thu May 20, 2021 6:32 am
Forum: Libraries and Tools
Topic: SUPER STRICT for LUA
Replies: 43
Views: 36611

Re: SUPER STRICT for LUA

Hello Jay and thank you for using SUPERSTRICT.
In your case, you have 2 options.
You can either require your lib files BEFORE requiring SUPERSTRICT.
Or you can put the following line at the top of your lib file:

Code: Select all

--!strict
by ivan
Tue May 18, 2021 8:15 am
Forum: Libraries and Tools
Topic: SUPER STRICT for LUA
Replies: 43
Views: 36611

Re: SUPER STRICT for LUA

Can you please post the entire file so I can test it?
by ivan
Tue May 18, 2021 7:58 am
Forum: Libraries and Tools
Topic: SUPER STRICT for LUA
Replies: 43
Views: 36611

Re: SUPER STRICT for LUA

It's thinking my function call is a variable I guess. How do I stop that? Yes, function calls are variables too. You have to make sure the function "Initialise2DArrays" is not global (or declare the function before you include SUPERSTRICT). Looking at your code "Initialise2DArrrays&q...
by ivan
Sun May 16, 2021 5:18 pm
Forum: Libraries and Tools
Topic: SUPER STRICT for LUA
Replies: 43
Views: 36611

Re: SUPER STRICT for LUA

You are right, it doesn't check main.lua by default.
One option is to include main twice: require("main")
Please note that you don't need to run SUPERSTRICT in real-time.
You can run a separate script that goes through all of the files in your game folder.
Thanks for using SUPERSTRICT.
by ivan
Fri May 14, 2021 4:40 am
Forum: Support and Development
Topic: I need to split up a table
Replies: 8
Views: 4148

Re: I need to split up a table

If your level generator is deterministic you can just send the initial random seed as well as the visible range and let the client reproduce the level from scratch. Note that the server would still need to provide information about the state of destructible tiles and so on.
by ivan
Mon May 10, 2021 6:41 am
Forum: General
Topic: Using assert to establish pre/post conditions?
Replies: 4
Views: 2665

Re: Using assert to establish pre/post conditions?

-- I'm not testing for nil because that would throw a runtime error and will be instantly obvious anyway. You are on the right path there - that's why you should rarely assert the "type" of the parameters. Also make sure you only assert parameters that are coming from an external source. ...
by ivan
Sun May 02, 2021 5:52 am
Forum: Support and Development
Topic: One for the mathematicians: mapping screen click to iso grid
Replies: 4
Views: 4823

Re: One for the mathematicians: mapping screen click to iso grid

It's possible to do this using just math (without a bitmap mask), but it depends on the tilt of the tile.
A while ago I wrote a short tutorial on:
https://2dengine.com/?p=isometric#Mouse ... tile_index
by ivan
Thu Apr 29, 2021 12:55 pm
Forum: General
Topic: How to reduce size of final build?
Replies: 6
Views: 4445

Re: How to reduce size of final build?

The way you zip the love file can also affect its final size. Make sure to choose the slowest and highest level of compression. PNGGauntlet can reduce the size of PNGs considerably and FLAC/OGG is considerably smaller than WAVs. You could also try minifying the Lua code, using something like https:/...
by ivan
Fri Apr 09, 2021 10:43 am
Forum: Games and Creations
Topic: Point in triangle
Replies: 3
Views: 2054

Re: Point in triangle

If I remember correctly from Ericson's book, it may be possible to do even further performance optimizations - but you have to know the triangle's winding/orientation in advance.
by ivan
Thu Apr 08, 2021 5:12 pm
Forum: Games and Creations
Topic: Point in triangle
Replies: 3
Views: 2054

Re: Point in triangle

Hello, I haven't tested your code, but I think there are a lot simpler and more efficient ways to test if a point is inside a triangle: https://2dengine.com/?p=intersections#Point_inside_triangle The issues with your code are: 1. The intermediate a,b,c tables. That's very inefficient 2. No "ear...