Note that there are some explanatory texts on larger screens.

plurals
  1. POLua: require() not working on iPhone
    primarykey
    data
    text
    <p>I am working on a shooting game on iPhone and I need lua for scripting levels, enemies, and etc. So I wrote a bullet script like this:</p> <pre><code>-- circular_bullet.lua local time_between_bullets = 0.2; ... function InitializeCircularBullet(objectName) ... end </code></pre> <p>and an enemy script:</p> <pre><code>-- level1_D2.lua require("circular_bullet.lua"); ... </code></pre> <p>But it turned out that the enemy script can't "require" the bullet script. I tried to look into lua library, and found out that in loadlib.c :</p> <pre><code>static int ll_require (lua_State *L) { ... if (lua_isfunction(L, -1)) /* did it find module? */ break; /* module loaded sucessfully */ else if (lua_isstring(L, -1)) /* loader returned error message? */ lua_concat(L, 2); /* accumulate it */ else lua_pop(L, 1); ... } </code></pre> <p>It would enter the "else if" branch, which means some error happened, but I have no idea how to read that error message.</p> <p>If I comment out the "require" line, the enemy "level1_D2" would work as intend without shooting bullet. I also did try copy the whole circular_bullet.lua into level1_D2.lua, and it worked, so the problem must be the require statement.</p> <p>Those two files are under root directory of the package. (I don't know how to make them in different directory, thus I had found out that Diner Dash kept its scripts in different directory.) However the two files are not in the same group in my Xcode project. I tried putting them in same group but nothing happened.</p> <p>Anyone knows what the problem is? Thanks a lot!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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