loadfile or dofile support to load code "as is"

hi,

it would be useful to have a way of including the contents of another file into my lua script

eg

setup.lua

1
initStuff()

ie level1.lua is effectively

1
2
initStuff()
doStuff()

@jmp909: I also looked into this when creating the sample app. I plan on eventually expanding on the sample app, using different graphics and changing a lot of things up to create a fully-functional game. Once I find the best way to modularize that code I'll share it, hopefully you come up with a solution before me :-)

loadfile and dofile are in effect disable to to restrictions on the Apple SDK Developer Agreement.

Carlos

ok thanks carlos

i can just restructure with a module

regards
j

Thanks to Lua's flexibility it's not particularly hard to modularize repetitious code. Here's an example I wrote with one approach to doing that:
http://developer.anscamobile.com/forum/2010/12/12/finding-objects-parent#comment-14209

views:1306 update:2011/9/18 14:43:09
corona forums © 2003-2011