Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-14-2007, 10:18 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Global functions are techincally possible, but they make programming actually much harder. It is making it even harder to find where the function is declared. We already have global variables, and we should not repeat that mess with global functions. It is much cleaner to put the functions in an npc and call NPCName.function(), or put it in a class.
Reply With Quote
  #2  
Old 09-14-2007, 04:13 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Stefan View Post
Global functions are techincally possible, but they make programming actually much harder. It is making it even harder to find where the function is declared. We already have global variables, and we should not repeat that mess with global functions. It is much cleaner to put the functions in an npc and call NPCName.function(), or put it in a class.
I suggested only functions in Control-NPC would be only ones qualifying as global, it would not be difficult at all to find out where they're declared if that is the case.
PHP Code:
// Script
function onCreated() {
  
addItem("sword"1);
}
// Control-NPC
public function addItem(archcount) {
  
player.mud.addItem(archcount);

Simple enough.

I'm not suggesting global functions be declared the same way that global variables are (since that would be a horror as you're saying), just that when the Control-NPC is compiled its functions added to the global list or something.

So basically, for the function lookup, if there is no prefix it would look at:
Local Object (this.) -> Control-NPC -> Static Globals.
__________________

Last edited by Inverness; 09-14-2007 at 06:22 PM..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.