Module talk:Sandbox/Sebschlicht

From Wikiversity
Jump to navigation Jump to search

Script Error[edit source]

Does anybody have an idea why title.getContent is causing script error such as in User:Sebschlicht/LearningUnit? The Lua documentation says there is a getContent-function for title objects. Why cant I use them? This also applies to exists, fileExists, canTalk, isTalkPage, fullUrl. Only a few are working, such as fullText and contentModel. --Sebschlicht (discusscontribs) 13:18, 24 May 2014 (UTC)

First, I think it's a property vs. method issue. GetContent requires a : (colon) rather than a . (period). Second, I think page may be a reserved word. Funny things happen when you overwrite one of the page-level variables. Go with title when you want a title object. I've had better success with that. Anyway, this code seems to be working now.
Note that in general, no one monitors your pages. It is best to leave questions on someone else's discuss page if you want to be sure they see it. I just happened to be reviewing the log and saw this one.
--Dave Braunschweig (discusscontribs) 14:33, 24 May 2014 (UTC)
Thank you very much, Dave! I were not aware of this, since library methods are called via colons. I thought of this but I used other names than page before, so the first one was bullseye. --Sebschlicht (discusscontribs) 15:09, 24 May 2014 (UTC)