Note that there are some explanatory texts on larger screens.

plurals
  1. POLua Error: "attempt to call a string value" under Android NDK?
    text
    copied!<p>My Lua scripts are compiled by <a href="http://loop.luaforge.net/release/preload.html" rel="nofollow">LOOP</a>, the compiled scripts module runs well in a desktop machine(OSX 10.7.5). But when I run it under Android phone (Android 2.3.6), it always fails and complains <code>attempt to call a string value</code>. The same scripts can run also without problems in script (not compiled) way in the same phone. </p> <p>Lua 5.1.5 and Android NDK r8b are used in the test.</p> <p>The error in logcat:</p> <pre class="lang-none prettyprint-override"><code>12-26 09:40:26.934: E/libb22luapre(8190): Failed to run script: attempt to call a string value </code></pre> <p>The C code snippet (error handling code removed for simplicity):</p> <pre class="lang-c prettyprint-override"><code>const char script[] = "require \"hello.world\"\n" "require \"anothermodule\"\n" "hello.world.test2()"; luaL_loadstring(L, script); lua_pcall(L, 0, LUA_MULTRET, 0); </code></pre> <p>I dumped the preloaded table, these required modules already exists (loaded successfully). </p> <p>I searched the web, still can not find a solution. Any advice will be greatly appreciated.</p> <p>[UPDATED] I compiled lua command for android and embed the compiled lua scripts in it. The error is just the same as above.</p> <pre class="lang-none prettyprint-override"><code>$ adb shell $ cd /data/local $ ls tmp lua dump_preload.lua $ ./lua dump_preload.lua --- print table --- preload test function: 0x376f0 anothermodule function: 0x37718 hello.world function: 0x376b0 --- print table --- loaded string table: 0x33828 debug table: 0x37098 package table: 0x33d30 _G table: 0x32528 io table: 0x34e80 os table: 0x357b8 table table: 0x332c0 math table: 0x36530 coroutine table: 0x33988 --- print table --- loaders 1 function: 0x33ed8 2 function: 0x33ef8 3 function: 0x33f18 4 function: 0x33f38 $ ./lua Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio &gt; require 'test' attempt to call a string value stack traceback: [C]: ? [C]: in function 'require' stdin:1: in main chunk [C]: ? &gt; require 'hello.world' attempt to call a string value stack traceback: [C]: ? [C]: in function 'require' stdin:1: in main chunk [C]: ? &gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload