c_lua_converge_optional_args: fixed pointers

This commit is contained in:
Logen Kain 2016-07-24 17:41:45 -07:00
parent 5fc5697825
commit fcec176008
2 changed files with 10 additions and 9 deletions

View File

@ -1,3 +1,3 @@
width = "Width"
heigt = "Height"
extra = "extra"
width = "Width line"
heigt = "Height line"
extra = "extra line"

View File

@ -26,7 +26,7 @@ int main ()
void load(char *filename, int number_of_args, ...){
int i =1;
char test[100];
char *test[number_of_args];
va_list opt_args;
@ -40,14 +40,15 @@ void load(char *filename, int number_of_args, ...){
for(i = 0; i < number_of_args; i++)
{
strcpy(test, va_arg(opt_args, char*));
lua_getglobal(L, test);
test[i] = va_arg(opt_args, char*);
lua_getglobal(L, test[i]);
if (!lua_isstring(L, (i+1))){
error(L, "%s Missing variable: %s%s\n",KRED, test, KNRM);
error(L, "%s Missing variable: %s%s\n",KRED, test[i], KNRM);
strcpy(test[i], " ");
continue;
}
strcpy(test, lua_tostring(L, (i+1) ));
printf("Is Test: %s\n", test);
strcpy(test[i], lua_tostring(L, (i+1) ));
//printf("Is Test: %s\n", test[i]);
}
va_end(opt_args);