I had never programmed in LUA, I thought I LUA or Basic was the same. I'm stupid to believe it ^ ^
I bought a book on Lua and is more than a vulgar BASIC interpreter, I just found an incredibly powerful language, but not enough restrictive.
I say this because I found a solution to my problem and also with the help of "macklebee"
and as I would like to benefit everyone, here is how I solved my problem:
Piste = {} -- as global
local function FindEntityByName(name)
for model in iterate(CurrentWorld().entities) do
if name == model:GetKey("Name") then
return model
end
end
return nil
end
local function GetSurfaceCouloirByName(ModName)
local ModPiste=FindEntityByName(ModName)
assert(ModPiste~= nil,"pas trouvé de piste "..ModName.." dans la scène")
local MeshPiste=ModPiste:FindChild("U3D_STATIC_MESH")
assert(MeshPiste~= nil,ModName.."trouvé mais pas de mesh portant le nom U3D_STATIC_MESH")
local NSurfacePiste=MeshPiste:CountSurfaces()
assert(NSurfacePiste > 0,ModName.."->U3D_STATIC_MESH n'a pas de surface !!!")
local SurfacePiste=MeshPiste:GetSurface(1)
return SurfacePiste
end
local function StorePathToTable(NonPiste,Surface)
local CntVertice = Surface:CountVertices()
assert(CntVertice > 0,"la surface n'a pas de vertice ! <StorePathToTable(Surface)>")
Piste[NonPiste] = nil
Piste[NonPiste] = {}
Piste[NonPiste][0] = Vec3(0)
for i = 1,CntVertice do
Piste[NonPiste][i] = Surface:GetVertexPosition(i)
end
end
local function ShowPathList(NomPiste)
local t = Piste[NomPiste]
local lt = #Piste[NomPiste] - 1
AppLog(lt)
for i = 1,lt do
AppLog(t[i].x)
end
end
function class:CreateObject(model)
local object=self.super:CreateObject(model)
AppLog("Begin------------------------------")
local TheSurface = GetSurfaceCouloirByName("Cou1")
StorePathToTable("Piste1",TheSurface)
ShowPathList("Piste1")
AppLog("End ------------------------------")
;-) thank for all
Gabriel