Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this .
larz
Prole
Posts: 9 Joined: Fri Jan 08, 2016 2:57 pm
Post
by larz » Fri Jan 08, 2016 9:30 pm
Code: Select all
local run={};
do
run.draw=love.draw;
function run.draw()
love.graphics.print("Hello.",100,100);
end
end
Why this doesn't works?
Ref
Party member
Posts: 702 Joined: Wed May 02, 2012 11:05 pm
Post
by Ref » Fri Jan 08, 2016 9:39 pm
Code: Select all
function love.draw()
love.graphics.print('Hello!',100,100)
end
larz
Prole
Posts: 9 Joined: Fri Jan 08, 2016 2:57 pm
Post
by larz » Fri Jan 08, 2016 10:03 pm
Can't i reffer to it by run.draw?
larz
Prole
Posts: 9 Joined: Fri Jan 08, 2016 2:57 pm
Post
by larz » Fri Jan 08, 2016 10:38 pm
Someone?
veethree
Inner party member
Posts: 877 Joined: Sat Dec 10, 2011 7:18 pm
Post
by veethree » Fri Jan 08, 2016 10:55 pm
Is there a reason why you don't want to just use love.draw?
I
think if you want to call it run.draw you would have to use a custom
love.run function.
slime
Solid Snayke
Posts: 3163 Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:
Post
by slime » Fri Jan 08, 2016 10:58 pm
Code: Select all
local run = {}
function run.draw()
love.graphics.print("hi")
end
love.draw = run.draw
(Not that it's particularly useful to do something like that...)
Ref
Party member
Posts: 702 Joined: Wed May 02, 2012 11:05 pm
Post
by Ref » Fri Jan 08, 2016 11:35 pm
But that doesn't print to the screen (at 100,100) but prints 'Hi 100 100".
Jasoco
Inner party member
Posts: 3726 Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:
Post
by Jasoco » Sat Jan 09, 2016 9:06 pm
You're overthinking it. Use this as a starting point:
Code: Select all
function love.load()
--Put stuff here that needs to be loaded once like creating images or fonts
end
function love.update(dt)
--Update things here using dt as a delta (Amount per second)
end
function love.draw()
love.graphics.print("Hello.", 100, 100)
end
While you can put functions in other functions, it won't do anything unless you actually call it.
And look at the Wiki.
PGUp
Party member
Posts: 105 Joined: Fri Apr 21, 2017 9:17 am
Post
by PGUp » Sun Jul 23, 2017 12:01 pm
Why do you need to make it very complex..
-
Users browsing this forum: No registered users and 4 guests