Search found 230 matches

by ReFreezed
Thu May 13, 2021 1:32 am
Forum: Libraries and Tools
Topic: LuaPreprocess - straightforward preprocessor with simple syntax
Replies: 37
Views: 35617

Re: LuaPreprocess - straightforward preprocessor with simple syntax

Hmm, I think I agree with you, so I added @@ as an alias for @insert.

Code: Select all

-- Have we reached nirvana yet?
@@assert(i >= 1 and i <= 5, "i out of range, expected: 1<=i<=5, actual: " .. i)
by ReFreezed
Wed May 12, 2021 5:18 pm
Forum: Libraries and Tools
Topic: LuaPreprocess - straightforward preprocessor with simple syntax
Replies: 37
Views: 35617

Re: LuaPreprocess - straightforward preprocessor with simple syntax

Because @blah is already used for preprocessor keywords I though about adding @@func() as new syntax (for what could be seen as a "user-defined" keyword), but I think reusing @insert like this makes more sense as it has similar functionality already, and I don't have to add a new kind of &...
by ReFreezed
Wed May 12, 2021 1:07 am
Forum: Libraries and Tools
Topic: LuaPreprocess - straightforward preprocessor with simple syntax
Replies: 37
Views: 35617

Re: LuaPreprocess - straightforward preprocessor with simple syntax

Any plans to include something like C/C++ preprocessor macro parameters? That is, to not need to pass the parameters as strings in the first place. I was going to write a long reply about how bad C/C++ macros were, but instead I started experimenting with how macros actually would work in this prep...
by ReFreezed
Wed May 12, 2021 12:42 am
Forum: Support and Development
Topic: Help with starting
Replies: 4
Views: 93

Re: Help with starting

Check the wiki: https://love2d.org/wiki/Getting_Started

Basically, you need to create a main.lua file in a folder, and then tell LÖVE to run that folder.
by ReFreezed
Mon May 10, 2021 10:53 pm
Forum: Support and Development
Topic: Integrating Effekseer's efk files
Replies: 8
Views: 3690

Re: Integrating Effekseer's efk files

I just want to say, nice work! This thread fits more in the Libraries and Tools forum at this point. :)
by ReFreezed
Mon May 10, 2021 2:09 pm
Forum: Support and Development
Topic: math.round() doesn't work
Replies: 4
Views: 116

Re: math.round() doesn't work

math.round doesn't exist in Lua by default. You'll have to define it yourself:

Code: Select all

math.round = function(n)
	return math.floor(n + 0.5)
end
See the Lua manual for all existing math functions.
by ReFreezed
Mon May 10, 2021 12:54 pm
Forum: Support and Development
Topic: I not can resize, the screen in love2d for android
Replies: 2
Views: 71

Re: I not can resize, the screen in love2d for android

Hello and welcome to the forums! I don't think you can change the screen resolution on Android. You can only specify if you want landscape mode or portrait mode by changing the ratio between the width and the height, which is why this code works: Portrait mode: love.window.setMode(1, 2) Landscape mo...
by ReFreezed
Mon May 10, 2021 12:37 pm
Forum: General
Topic: Using assert to establish pre/post conditions?
Replies: 4
Views: 100

Re: Using assert to establish pre/post conditions?

You shouldn't need to assert parameters that are coming from another part of your own code/library. I disagree there. For robustness and your own sanity, asserting that your program is actually doing what you think it does is always a good thing, especially when making changes in larger, or more co...
by ReFreezed
Mon May 10, 2021 12:04 pm
Forum: Libraries and Tools
Topic: LuaPreprocess - straightforward preprocessor with simple syntax
Replies: 37
Views: 35617

Re: LuaPreprocess - straightforward preprocessor with simple syntax

In addition to monolifed's solutions, the most straight-forward one-liner way is probably something like this: local ok = false !!(DEBUG and "assert(ok)" or "") -- Result: local ok = false assert(ok) !!(...) outputs a string as Lua code. You could also do something like this: !( ...