Hiii,
am using angular js as my front end php as my serverside
scripting language. I want to change the server language to 'LUA'. But
am a beginer in lua language. so help me to convert my login page in php
to lua.
login.php
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
$user =$_POST['email'];
$pass= $_POST['password'];
$result = null;
$str = file_get_contents('users.json');//get contents of your json file and store it in a string
$arr = json_decode($str, true);//decode it
for($i=0;$i<count($arr["users"]);$i++)
{
if(($arr["users"][$i]["username"] == $user) && ($arr["users"][$i]["password"] == $pass))
$result = "success";
}
$fp = fopen('a.txt','w');
fwrite($fp,$str);
fclose($fp);
echo json_encode($result);
?>
how can i convert these php file to lua ? Is that possible?