Thanks Namatsu! :)
I managed that to work! Thank you so much!
However, I got another problem now...
Quote:
-->Constants for Pointer Types
TYPE_ASE = 1000;
TYPE_3ds=1001;
TYPE_Texture=1002;
TYPE_DisplayList=1003;
TYPE_Object3D=1004;
-->
function SafePointer(myPointer, myPointerType)
if (myPointer~= nil) then
return {Pointer = myPointer, PointerType = myPointerType};
else
--> Debug.MessageBox("Problem!");
return nil;
end
end
function CheckPointer(FunctionName, DesiredPointerType, VariableToTest)
if (type(VariableToTest) == "table") then
if (VariableToTest.PointerType == DesiredPointerType) then
return true;
else
--> Debug.MessageBox("Incorrect parameter passed in ".. FunctionName .. ". A Safe Pointer must be passed of type " .. DesiredPointerType .. ". Parameter passed was of type ' " .. type(VariableToTest) .. " '.", "Incorrect parameter passed in " .. FunctionName);
return false;
end
else
--> Debug.MessageBox("Incorrect parameter passed in ".. FunctionName .. ". A Safe Pointer was NOT passed", "Incorrect parameter passed in " .. FunctionName);
return false;
end
end
function Mesh3D.NewASE(Filepath,TextureFilter,p1,p2,p3)
local tempPointer =Mesh3D.UnsafeNewASE(Filepath, TextureFilter, p1,p2,p3,done);
LastSafePointer = SafePointer(tempPointer , TYPE_ASE);
return LastSafePointer;
end
function Render.ASE(SafePointer_ASE,p1, p2, p3, p4)
if CheckPointer("Render.ASE", TYPE_ASE, SafePointer_ASE) then
Render.UnsafeASE(SafePointer_ASE.Pointer, p1, p2,p3,p4,done);
end
end
(This is not really a quote but I haven't found how to do the code tag. does not work ;)
So I first call:
mySafePointerTableASE =Mesh3D.NewASE("MyFile",1,2,3)
Render.ASE(mySafePointerTableASE, 4,5,6,7);
expecting that mySafePointerTableASE gets stored a table of type:
{Pointer = myPointer, PointerType = myPointerType}.
However when I call Render.ASE I get the following error:
"Attempt to index local 'SafePointer_ASE' (a userdata value)"
function Render.ASE(SafePointer_ASE,p1, p2, p3, p4) if CheckPointer("Render.ASE", TYPE_ASE, SafePointer_ASE) then Render.UnsafeASE(SafePointer_ASE.Pointer, p1, p2,p3,p4,done); end end
So yes... it's a userdata value (so the SafePointer structure got stored), but what's the problem with trying to access SafePointer_ASE.Pointer?!!?
Thanks so much in advance!
Cheers
Rod