Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Wed Oct 29, 2008 11:40 pm   

[FR] zs.(lua) function returns mapped
 
as we know, type mismatch is one of major annoyances programmer encounters...

and cmud passes returns trough autoconverter, which is btw. _absolutely_brilliant_ in handling variables
but when mapquery returns number for one room and table for more and roomexit can return string when theres only one exit it gets me Wink

master z, please, have function returns ran trough hardcoded conversion table
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Oct 30, 2008 6:38 pm   
 
I guess I'm not following you. Can you give me more specific examples that I can enter into CMUD that shows the problem you are having?
Reply with quote
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Thu Oct 30, 2008 7:51 pm   
 
this isnt really a problem, just would be nice to have some consistency regarding returns, atm i have 3 different wrappers for various combinations, hopefully wont need more, and they just double work that cmud already done (just differently)

anyway:
Code:
print(type(zs.roomexit()))


teleport to room with one exit and then with multiple exits
with one exit we get string, with multiple table, with no exits empty string... for roomexit would be logical to get either table in all cases or table if exits are present and nil if not, chosen convention should apply to all functions that can return multiple results (making returns uniform)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Oct 30, 2008 10:31 pm   
 
Ah, OK, I see what you are saying.

What CMUD is trying to do is convert a CMUD String List into a Lua table. But there is no way to tell the difference between a single string value and a string list with a single element. The CMUD Lua routine just simply looks for the | character to determine if a string result is a string list (or database variable). Since a single exit or no exits just returns a simple string without any | character, the Lua module has no way to convert it.

The problem is that CMUD is still typeless (auto-typed) as far as functions go. It's only CMUD variables that have a specific type. So, no way to fix this for now. I'd have to assign specific types to every function and that's something for the future.

At least you have a workaround.
Reply with quote
intoK
Apprentice


Joined: 18 Feb 2007
Posts: 190

PostPosted: Fri Oct 31, 2008 9:02 am   
 
All rights, good to hear its planed, cheers.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net