1 | <?php |
||
16 | class ScribuntoLuaLibrary extends Scribunto_LuaLibraryBase { |
||
17 | |||
18 | /** |
||
19 | * @var LibraryFactory |
||
20 | */ |
||
21 | private $libraryFactory; |
||
22 | |||
23 | /** |
||
24 | * This is the name of the key for error messages |
||
25 | * |
||
26 | * @var string |
||
27 | * @since 1.0 |
||
28 | */ |
||
29 | const SMW_ERROR_FIELD = 'error'; |
||
30 | |||
31 | /** |
||
32 | * @since 1.0 |
||
33 | */ |
||
34 | 33 | public function register() { |
|
47 | |||
48 | /** |
||
49 | * This mirrors the functionality of the parser function #ask and makes it |
||
50 | * available in lua. |
||
51 | * |
||
52 | * @since 1.0 |
||
53 | * |
||
54 | * @param string|array $arguments parameters passed from lua, string or array depending on call |
||
55 | * |
||
56 | * @return null|array[] |
||
57 | */ |
||
58 | 6 | public function ask ( $arguments = null ) { |
|
76 | |||
77 | /** |
||
78 | * Returns property type |
||
79 | * |
||
80 | * @since 1.0 |
||
81 | * |
||
82 | * @param string $propertyName |
||
83 | * |
||
84 | * @return array |
||
85 | */ |
||
86 | 5 | public function getPropertyType( $propertyName = null ) { |
|
103 | |||
104 | /** |
||
105 | * Returns query results in for of the standard API return format |
||
106 | * |
||
107 | * @since 1.0 |
||
108 | * |
||
109 | * @param string|array $arguments |
||
110 | * |
||
111 | * @return array |
||
112 | */ |
||
113 | 4 | public function getQueryResult( $arguments = null ) { |
|
127 | |||
128 | /** |
||
129 | * This mirrors the functionality of the parser function #info and makes it |
||
130 | * available to lua. |
||
131 | * |
||
132 | * @since 1.0 |
||
133 | * |
||
134 | * @param string $text text to show inside the info popup |
||
135 | * @param string $icon identifier for the icon to use |
||
136 | * |
||
137 | * @return string[] |
||
138 | */ |
||
139 | 6 | public function info( $text, $icon = 'info' ) { |
|
167 | |||
168 | /** |
||
169 | * This mirrors the functionality of the parser function #set and makes it |
||
170 | * available in lua. |
||
171 | * |
||
172 | * @since 1.0 |
||
173 | * |
||
174 | * @param string|array $arguments arguments passed from lua, string or array depending on call |
||
175 | * |
||
176 | * @return null|array|array[] |
||
177 | */ |
||
178 | 13 | public function set( $arguments ) { |
|
203 | |||
204 | /** |
||
205 | * This mirrors the functionality of the parser function #subobject and |
||
206 | * makes it available to lua. |
||
207 | * |
||
208 | * @param string|array $arguments arguments passed from lua, string or array depending on call |
||
209 | * @param string $subobjectId if you need to manually assign an id, do this here |
||
210 | * |
||
211 | * @return null|array|array[] |
||
212 | */ |
||
213 | 21 | public function subobject( $arguments, $subobjectId = null ) { |
|
247 | |||
248 | /** |
||
249 | * Takes a result returned from a parser function call and prepares it to be |
||
250 | * used as parsed string. |
||
251 | * |
||
252 | * @since 1.0 |
||
253 | * |
||
254 | * @param string|array $parserFunctionResult |
||
255 | * |
||
256 | * @return string |
||
257 | */ |
||
258 | 38 | private function doPostProcessParserFunctionCallResult( $parserFunctionResult ) { |
|
275 | |||
276 | /** |
||
277 | * Returns the LibraryFactory singleton (and creates it first, if not already present) |
||
278 | * |
||
279 | * @since 1.0 |
||
280 | * |
||
281 | * @return LibraryFactory |
||
282 | */ |
||
283 | 44 | private function getLibraryFactory() { |
|
295 | |||
296 | /** |
||
297 | * Takes the $arguments passed from lua and pre-processes them: make sure, |
||
298 | * we have a sequence array (not associative) |
||
299 | * |
||
300 | * @since 1.0 |
||
301 | * |
||
302 | * @param string|array $arguments |
||
303 | * |
||
304 | * @return array |
||
305 | */ |
||
306 | 44 | private function processLuaArguments( $arguments ) { |
|
325 | |||
326 | } |
||
327 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: