"Questions that don't deserve their own thread" thread
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 106
- Joined: Sat Jun 21, 2014 3:45 pm
Re: "Questions that don't deserve their own thread" thread
I want to give a shot at computing the lighting via a shader and was wondering if there's a way to get the colors of another pixel (in whatever direction) ?
Re: "Questions that don't deserve their own thread" thread
I have little question, how to make something work only for all numbers more from n?
For example:
For example:
Code: Select all
egg = {1,2.3.4,5}
n = 2
--egg 3,4 and 5 do /something/
Re: "Questions that don't deserve their own thread" thread
IceQB wrote:I have little question, how to make something work only for all numbers more from n?
For example:Code: Select all
egg = {1,2.3.4,5} n = 2 --egg 3,4 and 5 do /something/
Code: Select all
if egg>2 then do...
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: "Questions that don't deserve their own thread" thread
Does n refer to index or value?
If the former, I'd use a numeric for loop:
otherwise it's a bit more complicated and it depends on a lot of things what the best way to go about it would be. (Probably either looking up the index with binary search, or building a reverse-lookup table beforehand.)
If the former, I'd use a numeric for loop:
Code: Select all
for i = n + 1, #egg do
--- do something with egg[i]
end
Help us help you: attach a .love.
Re: "Questions that don't deserve their own thread" thread
Thanks Robin, It is it what I was looking for.
Re: "Questions that don't deserve their own thread" thread
Question on optional args...
In its own script apart from LÖVE, this works. In my project it does not, printing this instead.
What does LÖVE do differently?
Code: Select all
wordbank = { }
function wordbank.init()
wordbank.activate("goosanders", "optional flag")
end
function wordbank.activate(selection, ...)
for idx, flag in ipairs(arg) do
print(flag)
-- e.g. "optional flag" prints here
end
end
wordbank.init()
Code: Select all
%project path% love.exe
embedded boot.lua
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: "Questions that don't deserve their own thread" thread
LÖVE uses LuaJIT, based on Lua 5.1, which doesn't use arg anymore.
Change this:
to this:
[edit] See also this topic.
Change this:
Code: Select all
for idx, flag in ipairs(arg) do
Code: Select all
for idx, flag in ipairs(...) do
- Zilarrezko
- Party member
- Posts: 345
- Joined: Mon Dec 10, 2012 5:50 am
- Location: Oregon
Re: "Questions that don't deserve their own thread" thread
I'm putting my question here because I think I'm starting to clutter stuff up with my own topics.
So I've been working with 3D for the past few weeks. Mostly looking forward into concepts that I'll need in the future.
I've watch oysi's videos of course, but I wanted to walk myself forward without watching a tutorial and it seems I've hit a snag on something several times in the same spot. and of all things I believe it's either tables confusing me (A lot of tables within tables), or I'm doing something that lua can't do.
The problem is in my algorithm at line 44
and bonus points to whoever can get the model loader to recognize 3 vertex face from a 4 vertex face and run the proper one and not both.
PS. Very inefficient, yet functional shunting yard algorithm in there with reverse polish notation calculator too.
So I've been working with 3D for the past few weeks. Mostly looking forward into concepts that I'll need in the future.
I've watch oysi's videos of course, but I wanted to walk myself forward without watching a tutorial and it seems I've hit a snag on something several times in the same spot. and of all things I believe it's either tables confusing me (A lot of tables within tables), or I'm doing something that lua can't do.
The problem is in my algorithm at line 44
and bonus points to whoever can get the model loader to recognize 3 vertex face from a 4 vertex face and run the proper one and not both.
PS. Very inefficient, yet functional shunting yard algorithm in there with reverse polish notation calculator too.
- Attachments
-
- _Workspace.love
- Here's about 4 weeks of work and thought, have fun.
- (387.36 KiB) Downloaded 166 times
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: "Questions that don't deserve their own thread" thread
You meanDaedalusYoung wrote:Code: Select all
for idx, flag in ipairs(...) do
Code: Select all
for idx, flag in ipairs({...}) do
Code: Select all
for idx, flag in ipairs{...} do
Who is online
Users browsing this forum: Google [Bot] and 0 guests