Quote: "They can't!"
For examples sake, I will use my game's main source file, which I will tell you now, does compile, and does work.
//**********Constants**********
#constant True 1
#constant False 0
#constant PI 3.14159
//**********Includes**********
#include "Include/physics.dba"
#include "Include/cache.dba"
#include "Include/map.dba"
#include "Include/player.dba"
#include "Include/system.dba"
#include "Include/console.dba"
#include "Include/entities.dba"
//Start
start()
//**********Start**********
function start()
//Init Libraries
//--------------
lua make True
startConsole("ZBall", "1.0", 12)
startMap()
startCache()
kx_startKinetix()
//Setup
//-----
setupZBall("ZBall.ini")
//Console Data
//------------
addConsoleComment("Screen")
global _cnl_fps as integer : _cnl_fps = addConsoleLine("FPS: ", "")
global _cnl_poly as integer : _cnl_poly = addConsoleLine("Polygons: ", "")
addConsoleBlank()
addConsoleComment("Player")
global _cnl_posx as integer : _cnl_posx = addConsoleLine("Pos X: ", "")
global _cnl_posy as integer : _cnl_posy = addConsoleLine("Pos Y: ", "")
global _cnl_posz as integer : _cnl_posz = addConsoleLine("Pos Z: ", "")
//Temp
//----
loadLevel(1)
//Call Main Function
//------------------
main()
endfunction
//**********Main**********
function main()
//Main Loop
do
//Control Entities
controlEntities()
//Player control
controlPlayer(upkey(), downkey(), leftkey(), rightkey(), spacekey(), shiftkey())
//Control Player Camera
controlCamera()
//Control Levels
controlLevels()
//Call main function
callMain()
//Debug
if ((mouseclick() = 1) && ((mousex() < (cnlx + 175)) || (mousex() > (cnlx + 200)) ))
cnlx = mousex()
cnly = mousey()
endif
setConsole(cnlx, cnly, 200)
setConsoleData(_cnl_fps, str$(screen fps()))
setConsoleData(_cnl_poly, str$(statistic(1)))
setConsoleData(_cnl_posx, str$(int(object position x(_player.Obj))))
setConsoleData(_cnl_posy, str$(int(object position y(_player.Obj))))
setConsoleData(_cnl_posz, str$(int(object position z(_player.Obj))))
//Synchronise
sync
//Continue loop
loop
endfunction
//**********UDTs**********
//3D Vector
type vec3
x as float
y as float
z as float
endtype
//Console
type tConsole
lineType as integer
cLine as string
dat as string
endtype
//Entity Data
type tEntity
obj as integer
control as string
endtype
//Player
type tPlayer
Obj as integer // Object number
Img as integer // Image number
Cube as integer // Cubemap image number
Turn as float // Turning value
Jump as float // Jump value
Size as float // Sphere size
Body as integer // Physics body number
Mat as integer // Physics material number
MVec as integer // Movement vector
RVec as integer // Rotation vector
Mass as float // Mass
DragC as float // Drag Constant
Dens as float // Density
Thrust as float // Thrust value
CamOff as vec3 // Player-Camera Offset
CamPos as vec3 // Positions of camera
CamSmooth as float // Smooth movement for camera
LastDir as integer // Direction (for rolling)
endtype
As you can see, there is no end statement. All it is, is functions, types, a few constants and a few includes. The main loop is inside the main() function.
Quote: ""start()" is your main code, and you cannot move it down"
It will get an error if it runs into a function declaration, but that has nothing to do with the actual structure of the code.