Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Model & Packages
Started by iphone_2010 Nov 20 2010 02:50 AM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

iphone_2010

[GLOBAL: userInfoPane.html]
iphone_2010
  • Enthusiast

  • 92 posts
  • Guests

What is the model and Packages? (module(..., package.seeall))

How can i create my own model. One more thing which i cannot understand is g:functionname()

What is the g exactly and how can i create my own properties?
function g:evenname( event )
-- body
end
uid: 11038 topic_id: 3828 reply_id: 303828


[TOPIC: post.html]
#2

jmp909

[GLOBAL: userInfoPane.html]
jmp909
  • Corona Geek

  • 1,328 posts
  • Corona SDK

that looks like it's from the movieclip.lua file

if you read through the code then g is the display group created when the newAnim function is called and returned from the module at the end

function newAnim (imageTable)	-- Set up graphics	local g = display.newGroup()          ..  	-- Return instance of anim	return gend


g:someFunc(whatever) is the equivalent of g.someFunc(self, whatever)

it takes a while to understand and there are different ways of doing things, even in the supplied examples. Some contain functions within functions (eg movieclip.lua) whereas some are defined against the "class" object (facebook.lua)

the best thing you can do is study the modules and the way they are called from main.lua

j

uid: 6645 topic_id: 3828 reply_id: 11656


[TOPIC: post.html]
#3

iphone_2010

[GLOBAL: userInfoPane.html]
iphone_2010
  • Enthusiast

  • 92 posts
  • Guests

What is the point here of using the g:someFunc(). and i have noticed that you have returned the g in (return g) what does that mean>

one more thing: what is the different between g:repeatFunction( event ) and calling the function it self again recursive like g:someFun()

Thanks
uid: 11038 topic_id: 3828 reply_id: 11677


[TOPIC: post.html]
#4

jmp909

[GLOBAL: userInfoPane.html]
jmp909
  • Corona Geek

  • 1,328 posts
  • Corona SDK

i suggest you read through these:
http://developer.anscamobile.com/content/introduction
http://developer.anscamobile.com/content/lua-standard-libraries

they explain some of the basics of the language
uid: 6645 topic_id: 3828 reply_id: 11679



[topic_controls]
[/topic_controls]