Difference between revisions of "Talk:Writing CEGUI scripts"

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search
Line 2: Line 2:
  
 
eg.
 
eg.
function slider_ValueChanged(event)
 
  local we = CEGUI.toWindowEventArgs(event);
 
  local slider = tolua.cast(we.window, "CEGUI::Slider");
 
  
   -- do stuff with a real slider
+
   function slider_ValueChanged(event)
  local value = slider:getCurrentValue();
+
    local we = CEGUI.toWindowEventArgs(event);
 
+
    local slider = tolua.cast(we.window, "CEGUI::Slider");
  -- ...
+
    -- do stuff with a real slider
 
+
    local value = slider:getCurrentValue();
end
+
    -- ...
 +
  end

Revision as of 18:25, 23 November 2005

Great article! I'd also like to share that you can use tolua.cast() to cast a window to a more specific class so you can access those specific functions.

eg.

 function slider_ValueChanged(event)
   local we = CEGUI.toWindowEventArgs(event);
   local slider = tolua.cast(we.window, "CEGUI::Slider");
   -- do stuff with a real slider
   local value = slider:getCurrentValue();
   -- ...
 end