cBlockArea
#11
Do you think a
cBlockArea:DoWithEveryBlock(
-- Code here)
function in C++ exported to Lua is faster then
for X=0, BlockAreaWidthX do
   for Y=0, BlockAreaWidthY do
      for Z=0, BlockAreaWidthZ do
         -- Code here
      end
   end
end
in Lua?
Reply
Thanks given by:
#12
Not sure, would have to be measured. The cost of callbacks is small but not negligible. It might even depend on the "Code here".
Reply
Thanks given by:
#13
Back to the callback, I need something that does the opposite of MakeIndex. I need the X, Y and Z position from the blockcount.
Reply
Thanks given by:
#14
I'm afraid you'll have to code that one yourself, for now.
Reply
Thanks given by:
#15
Wow I didn't expect this to work:
function cBlockArea:SetName(a_Name)
  self.Name = a_Name
  return true
end

local Blck = cBlockArea()
Blck:SetName("TestName")
print(Blck.Name)

This is kinda useless, but I didn't think we could have custom functions in the userdata.
Reply
Thanks given by:
#16
It is possible in Lua; MCS could theoretically prevent this, but why bother. The only problem is that such extra properties (self.Name) won't get carried across some boundaries, such as inter-plugin comm, or callbacks (such as setting such a property in a cPlayer object and then doing ForEachPlayer later on)
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)